Run the deploy job's smoke test by default
Build, test, deploy / site (push) Successful in 7m22s

After publishing, the job asks the live site for its version and fails
if it is not the commit it published. The test ran only when the
repository variable SITE_URL was set, and it was not, so a job that
published to a directory nothing serves passed. The address defaults to
https://pplus.scient.ing; SITE_URL still overrides it.
This commit is contained in:
alexm committed 2026-11-13 06:50:58 -05:00
1 parent 3c5097d9d0
commit d1955ad358
3 files changed
+7 -5

No files matched your search

+5 -4
View File
@@ -14,7 +14,7 @@
#
# Repository -> Settings -> Actions -> Variables (all optional):
# SITE_SLUG the directory under /srv/www (defaults to pplus, the directory docs/Caddyfile serves)
# SITE_URL e.g. https://pplus.scient.ing, turns on the smoke test
# SITE_URL where the site is served, for the smoke test (defaults to https://pplus.scient.ing)
name: Build, test, deploy
on:
push:
@@ -98,15 +98,16 @@ jobs:
GITHUB_SHA: ${{ github.sha }}
run: scripts/deploy.sh "$SLUG"
# the live site must now say it is this commit: a job that publishes where nothing is served fails here
- name: Smoke test
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && vars.SITE_URL != ''
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
shell: bash
env:
SITE_URL: ${{ vars.SITE_URL }}
SITE_URL: ${{ vars.SITE_URL || 'https://pplus.scient.ing' }}
GITHUB_SHA: ${{ github.sha }}
run: |
sleep 2
live=$(curl -fsS "$SITE_URL/VERSION")
live=$(curl -fsS --retry 3 --retry-delay 2 "$SITE_URL/VERSION")
case "$live" in
"${GITHUB_SHA:0:12}"*) echo "live site is at $live" ;;
*) echo "live site reports '$live', expected ${GITHUB_SHA:0:12}" >&2; exit 1 ;;