Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
url: ${{ steps.deployment.outputs.page_url || steps.deployment_2.outputs.page_url || steps.deployment_3.outputs.page_url || steps.deployment_4.outputs.page_url }}
steps:
- uses: actions/checkout@v7
with:
Expand Down Expand Up @@ -122,12 +122,41 @@ jobs:
- uses: actions/upload-pages-artifact@v5
with:
path: _site
# Asked up to four times, because the first ask can come too soon.
# deploy-pages finds the artifact by listing this run's, and that listing
# can lag the upload it follows by several seconds: two of eight deploys
# here failed "No artifacts named github-pages were found" with the
# artifact uploaded the same second, and it is actions/deploy-pages#451
# for everybody who uploads and deploys in one job. Not a sleep -- the
# lag has outgrown fixed delays others tried -- and not a re-run of the
# job, which uploads a second artifact and then fails on finding two. The
# step again, in the same job, against the same artifact. A run whose
# first ask works pays nothing.
- id: deployment
uses: actions/deploy-pages@v5
continue-on-error: true
- if: steps.deployment.outcome == 'failure'
run: sleep 10
- id: deployment_2
if: steps.deployment.outcome == 'failure'
uses: actions/deploy-pages@v5
continue-on-error: true
- if: steps.deployment_2.outcome == 'failure'
run: sleep 30
- id: deployment_3
if: steps.deployment_2.outcome == 'failure'
uses: actions/deploy-pages@v5
continue-on-error: true
- if: steps.deployment_3.outcome == 'failure'
run: sleep 60
# The last ask fails the job as before, and says so in its own name.
- id: deployment_4
if: steps.deployment_3.outcome == 'failure'
uses: actions/deploy-pages@v5

# Closes the loop. Everything above proves the code is good and the
# artifact was uploaded; only this proves the live site is serving it.
# Deploys were silently broken for two merges once, with CI green
# throughout, because nothing ever asked production a question.
- name: Smoke test the deployed site
run: ./scripts/smoke-test.sh "${{ steps.deployment.outputs.page_url }}" _site
run: ./scripts/smoke-test.sh "${{ steps.deployment.outputs.page_url || steps.deployment_2.outputs.page_url || steps.deployment_3.outputs.page_url || steps.deployment_4.outputs.page_url }}" _site
32 changes: 22 additions & 10 deletions scripts/smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,31 @@ done <<< "$(python3 "$(dirname "$0")/../.github/scripts/check-references.py" --l
# that failed five of ten scheduled deploys in November 2026, each one naming
# a different handful of files that were never in the artifact. So an answer
# that is neither 404 nor 200 is asked again, and only a 200 is a leak.
#
# Asked as long as every other check here waits -- ATTEMPTS rounds, ten seconds
# apart -- and in rounds, every unsettled path once a round, so a site that is
# down fails in that time and not in seven times it. Five tries two seconds
# apart was not enough: on 22 November README.md still answered 503 fifteen
# seconds after it was first asked.
leaked=0
for path in /package.json /package-lock.json /README.md /test/harness.mjs \
/scripts/build-icons.sh /icons/icon.svg /design/icon.svg; do
for i in 1 2 3 4 5; do
pending="/package.json /package-lock.json /README.md /test/harness.mjs
/scripts/build-icons.sh /icons/icon.svg /design/icon.svg"
for i in $(seq 1 "$ATTEMPTS"); do
still=""
for path in $pending; do
code="$(status "$BASE/${path#/}")"
case "$code" in 404|200) break ;; esac
[ "$i" -lt 5 ] && sleep 2
case "$code" in
404) ;;
200) fail "$path is published; the artifact should be the site only"; leaked=1 ;;
*) still="$still $path:$code" ;;
esac
done
case "$code" in
404) ;;
200) fail "$path is published; the artifact should be the site only"; leaked=1 ;;
*) fail "$path could not be checked: still $code after 5 tries"; leaked=1 ;;
esac
[ -z "$still" ] && break
pending="$(for p in $still; do echo "${p%%:*}"; done)"
[ "$i" -lt "$ATTEMPTS" ] && sleep 10
done
for p in $still; do
fail "${p%%:*} could not be checked: still ${p##*:} after $ATTEMPTS tries"; leaked=1
done
[ "$leaked" -eq 0 ] && echo " ok no source files published"

Expand Down