Verify changed production CSS and rendered UI after QA-approved promotion
This commit is contained in:
parent
2f7257f823
commit
9f6ed42b0a
123
.github/workflows/deploy-timeweb.yml
vendored
123
.github/workflows/deploy-timeweb.yml
vendored
@ -2,7 +2,7 @@ name: Verify Caterium on Timeweb
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Caterium QA"]
|
||||
workflows: ["Caterium QA", "Caterium Direct Production"]
|
||||
types: [completed]
|
||||
workflow_dispatch:
|
||||
|
||||
@ -18,69 +18,98 @@ jobs:
|
||||
if: >-
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(github.event.workflow_run.conclusion == 'success' &&
|
||||
github.event.workflow_run.head_branch == 'production')
|
||||
((github.event.workflow_run.name == 'Caterium QA' &&
|
||||
github.event.workflow_run.head_branch == 'production') ||
|
||||
(github.event.workflow_run.name == 'Caterium Direct Production' &&
|
||||
github.event.workflow_run.head_branch == 'main')))
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 25
|
||||
env:
|
||||
TIMEWEB_BASE_URL: https://app.caterium.ru
|
||||
|
||||
steps:
|
||||
# A GITHUB_TOKEN push to production does not start another push workflow.
|
||||
# Observe successful promotion directly and read its published branch.
|
||||
- name: Checkout tested production revision
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || 'production' }}
|
||||
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Caterium QA' && github.event.workflow_run.head_sha || 'production' }}
|
||||
|
||||
- name: Wait for Timeweb cron deployment
|
||||
- name: Wait for the exact published assets
|
||||
timeout-minutes: 18
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
login_file="public/core/login-signature-v1776.js"
|
||||
logo_file="public/caterium-mark-light.svg"
|
||||
sw_file="public/service-worker.js"
|
||||
|
||||
test -s "$login_file"
|
||||
test -s "$logo_file"
|
||||
test -s "$sw_file"
|
||||
|
||||
local_login="$(sha256sum "$login_file" | awk '{print $1}')"
|
||||
local_logo="$(sha256sum "$logo_file" | awk '{print $1}')"
|
||||
local_sw="$(sha256sum "$sw_file" | awk '{print $1}')"
|
||||
|
||||
echo "Expected login sha256: $local_login"
|
||||
echo "Expected logo sha256: $local_logo"
|
||||
echo "Expected SW sha256: $local_sw"
|
||||
|
||||
files=(
|
||||
index.html
|
||||
app-runtime.js
|
||||
core/login-signature-v1776.js
|
||||
core/login-signature-v1776.css
|
||||
core/help-center.js
|
||||
core/help-center.css
|
||||
caterium-mark-light.svg
|
||||
service-worker.js
|
||||
)
|
||||
temp_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "$temp_dir"' EXIT
|
||||
revision="$(git rev-parse HEAD)"
|
||||
echo "Verifying tested production revision: $revision"
|
||||
for file in "${files[@]}"; do test -s "public/$file"; done
|
||||
for attempt in $(seq 1 18); do
|
||||
stamp="${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${attempt}"
|
||||
echo "Attempt $attempt/18"
|
||||
|
||||
if curl -fsSL --connect-timeout 10 --max-time 30 \
|
||||
"${TIMEWEB_BASE_URL}/core/login-signature-v1776.js?deploy_check=${stamp}" \
|
||||
-o /tmp/caterium-login.js && \
|
||||
curl -fsSL --connect-timeout 10 --max-time 30 \
|
||||
"${TIMEWEB_BASE_URL}/caterium-mark-light.svg?deploy_check=${stamp}" \
|
||||
-o /tmp/caterium-mark.svg && \
|
||||
curl -fsSL --connect-timeout 10 --max-time 30 \
|
||||
"${TIMEWEB_BASE_URL}/service-worker.js?deploy_check=${stamp}" \
|
||||
-o /tmp/caterium-sw.js; then
|
||||
remote_login="$(sha256sum /tmp/caterium-login.js | awk '{print $1}')"
|
||||
remote_logo="$(sha256sum /tmp/caterium-mark.svg | awk '{print $1}')"
|
||||
remote_sw="$(sha256sum /tmp/caterium-sw.js | awk '{print $1}')"
|
||||
|
||||
echo "Remote login sha256: $remote_login"
|
||||
echo "Remote logo sha256: $remote_logo"
|
||||
echo "Remote SW sha256: $remote_sw"
|
||||
|
||||
if [ "$remote_login" = "$local_login" ] && [ "$remote_logo" = "$local_logo" ] && [ "$remote_sw" = "$local_sw" ]; then
|
||||
echo "Timeweb production is current, including refreshed PWA cache."
|
||||
exit 0
|
||||
matched=true
|
||||
: > "$temp_dir/hashes.txt"
|
||||
for file in "${files[@]}"; do
|
||||
expected="$(sha256sum "public/$file" | awk '{print $1}')"
|
||||
if ! curl -fsSL --connect-timeout 10 --max-time 20 \
|
||||
-H 'Cache-Control: no-cache' \
|
||||
"${TIMEWEB_BASE_URL}/${file}?deploy_check=${stamp}" \
|
||||
-o "$temp_dir/asset"; then
|
||||
echo "Not reachable yet: $file"
|
||||
matched=false
|
||||
break
|
||||
fi
|
||||
else
|
||||
echo "Timeweb is not reachable yet."
|
||||
actual="$(sha256sum "$temp_dir/asset" | awk '{print $1}')"
|
||||
echo "$file expected=$expected actual=$actual"
|
||||
if [ "$actual" != "$expected" ]; then
|
||||
echo "Waiting for updated asset: $file"
|
||||
matched=false
|
||||
break
|
||||
fi
|
||||
printf '%s %s\n' "$actual" "$file" >> "$temp_dir/hashes.txt"
|
||||
done
|
||||
if [ "$matched" = true ]; then
|
||||
echo "PASS: all ${#files[@]} production assets match the tested revision."
|
||||
{
|
||||
echo '## Timeweb publication verified'
|
||||
echo "Revision: \`$revision\`"
|
||||
echo
|
||||
echo 'All checked production assets match byte-for-byte:'
|
||||
echo '```text'
|
||||
cat "$temp_dir/hashes.txt"
|
||||
echo '```'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sleep 30
|
||||
done
|
||||
|
||||
echo "::error::Timeweb did not reach the tested Caterium revision within 9 minutes."
|
||||
echo '::error::Timeweb did not publish the tested assets within the allotted retries.'
|
||||
exit 1
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- run: npm ci
|
||||
- run: npx playwright install --with-deps chromium
|
||||
- name: Check the published loading screen and Help icon
|
||||
timeout-minutes: 4
|
||||
run: node tests/production-ui-smoke.mjs
|
||||
- name: Save production UI verification
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: production-ui-verification
|
||||
path: production-ui-results/
|
||||
if-no-files-found: ignore
|
||||
retention-days: 7
|
||||
|
||||
Loading…
Reference in New Issue
Block a user