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): # Repository -> Settings -> Actions -> Variables (all optional):
# SITE_SLUG the directory under /srv/www (defaults to pplus, the directory docs/Caddyfile serves) # 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 name: Build, test, deploy
on: on:
push: push:
@@ -98,15 +98,16 @@ jobs:
GITHUB_SHA: ${{ github.sha }} GITHUB_SHA: ${{ github.sha }}
run: scripts/deploy.sh "$SLUG" 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 - 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 shell: bash
env: env:
SITE_URL: ${{ vars.SITE_URL }} SITE_URL: ${{ vars.SITE_URL || 'https://pplus.scient.ing' }}
GITHUB_SHA: ${{ github.sha }} GITHUB_SHA: ${{ github.sha }}
run: | run: |
sleep 2 sleep 2
live=$(curl -fsS "$SITE_URL/VERSION") live=$(curl -fsS --retry 3 --retry-delay 2 "$SITE_URL/VERSION")
case "$live" in case "$live" in
"${GITHUB_SHA:0:12}"*) echo "live site is at $live" ;; "${GITHUB_SHA:0:12}"*) echo "live site is at $live" ;;
*) echo "live site reports '$live', expected ${GITHUB_SHA:0:12}" >&2; exit 1 ;; *) echo "live site reports '$live', expected ${GITHUB_SHA:0:12}" >&2; exit 1 ;;
+1
View File
@@ -35,6 +35,7 @@ No version has been tagged yet. What programs mean is pplus-core's, and its chan
### Fixed ### Fixed
- The deploy job publishes to `/srv/www/pplus`, the directory the site is served from, unless `SITE_SLUG` says otherwise. Its default was the repository's name, so the job published to `/srv/www/pplus-web` and the live site did not change. - The deploy job publishes to `/srv/www/pplus`, the directory the site is served from, unless `SITE_SLUG` says otherwise. Its default was the repository's name, so the job published to `/srv/www/pplus-web` and the live site did not change.
- The deploy job's smoke test always runs on `main`: it asks the live site for its version after publishing, at `https://pplus.scient.ing` unless `SITE_URL` names another address. It ran only when that variable was set, and it was not.
- `docs/Caddyfile` served the page in place at a missing nested path, where its own files could not be found (a blank page). A missing page is sent to `/`; a missing file is a plain 404. - `docs/Caddyfile` served the page in place at a missing nested path, where its own files could not be found (a blank page). A missing page is sent to `/`; a missing file is a plain 404.
- Core's limits reach the site: no text in a pane, a link or a file ends in the engine's own error; a CSV export cannot start a spreadsheet formula; a framed Quarto view cannot make itself taller than 4,000px. - Core's limits reach the site: no text in a pane, a link or a file ends in the engine's own error; a CSV export cannot start a spreadsheet formula; a framed Quarto view cannot make itself taller than 4,000px.
- From the library, the nav's Problems and Reference links opened nothing. - From the library, the nav's Problems and Reference links opened nothing.
+1 -1
View File
@@ -27,7 +27,7 @@ The swap is one rename, so nobody sees a half-copied site, and a rollback is `ln
What the runner has to bring is small: git and Node (for `actions/checkout`), bash, curl, tar, `sha256sum`, and a `/srv/www` the job can write (or rsync and SSH to the machine that has it, below). The same workflow runs on a runner in host mode (a label registered as `quarto-deploy:host`: steps run on the machine's own shell as the runner's user, which then needs those tools and write access to `/srv/www`); there pixi's package cache and the fetched pixi in `~/.cache` last from job to job. What the runner has to bring is small: git and Node (for `actions/checkout`), bash, curl, tar, `sha256sum`, and a `/srv/www` the job can write (or rsync and SSH to the machine that has it, below). The same workflow runs on a runner in host mode (a label registered as `quarto-deploy:host`: steps run on the machine's own shell as the runner's user, which then needs those tools and write access to `/srv/www`); there pixi's package cache and the fetched pixi in `~/.cache` last from job to job.
`SITE_SLUG` (repository variable) names the directory under `/srv/www` and defaults to `pplus`, the directory the Caddyfile serves (it defaulted to the repository's name, and the first job on this repository published to `/srv/www/pplus-web`, which nothing serves). Set `SITE_URL` as well: it turns on a smoke test that fetches `/VERSION` from the live site and fails the job if it is not the deployed commit, which is what catches a job that publishes where nothing is served. On GitHub Actions the build and test steps run unchanged with `runs-on: ubuntu-latest`; publishing needs the droplet. `SITE_SLUG` (repository variable) names the directory under `/srv/www` and defaults to `pplus`, the directory the Caddyfile serves (it defaulted to the repository's name, and the first job on this repository published to `/srv/www/pplus-web`, which nothing serves). After publishing, a smoke test fetches `/VERSION` from the live site, at `SITE_URL` (repository variable, `https://pplus.scient.ing` when unset), and fails the job if it is not the deployed commit, which is what catches a job that publishes where nothing is served. On GitHub Actions the build and test steps run unchanged with `runs-on: ubuntu-latest`; publishing needs the droplet.
**Once the repositories are public**, a pull request from a fork runs its own workflow file and code on this runner, in a container that can write `/srv/www`. Run pull requests only from branches of the repository itself (each workflow's job has an `if:` that does that), or require approval for fork runs in Gitea's repository settings where the version offers it, or give pull requests a separate runner that cannot write the web root. **Once the repositories are public**, a pull request from a fork runs its own workflow file and code on this runner, in a container that can write `/srv/www`. Run pull requests only from branches of the repository itself (each workflow's job has an `if:` that does that), or require approval for fork runs in Gitea's repository settings where the version offers it, or give pull requests a separate runner that cannot write the web root.