# Programming+ on Gitea Actions, with a runner that has no container image: # the act_runner runs jobs directly on the droplet's shell ("host mode"). # # Runner setup, once, on the droplet (docs/deploy.md): # - node >= 20, git, rsync installed; a `deploy` user that can write /srv/www # - act_runner registered with the host-mode label this file's `runs-on` names: # act_runner register --instance https://git.example --token ... --labels "quarto-deploy:host" # (the `:host` suffix is what makes jobs run on the machine instead of in docker) # # Every push and pull request builds and tests. A push to main also publishes # the site to /srv/www/ as an atomic release (scripts/deploy.sh). # # Repository → Settings → Actions → Variables (all optional): # SITE_SLUG the directory under /srv/www (defaults to the repository name) # SITE_URL e.g. https://pplus.scient.ing, turns on the smoke test name: Build, test, deploy on: push: branches: [main] pull_request: workflow_dispatch: concurrency: group: deploy-${{ gitea.ref }} cancel-in-progress: true jobs: site: # The host-mode label from the runner registration. Jobs run as the # runner's user, in a fresh working directory, with the host's node. runs-on: quarto-deploy steps: # actions/checkout needs node on the host, which the job needs anyway. # core/ is pplus-core, a submodule pinned to one commit; the job's token # must be able to read that repository. - uses: actions/checkout@v4 with: submodules: recursive - name: Toolchain on the host run: | node --version npm --version git --version command -v rsync >/dev/null || echo "rsync missing: local deploys fall back to cp, SSH deploys need it" - run: npm ci # Builds core (with this repository's TypeScript), then the site, then tests the site. - run: npm test # pplus-core's own tests, at the pinned commit (its CI runs them too; this catches a bad pin). - name: Core's tests run: node --test tests/*.test.mjs working-directory: core # Core's mojo-status-strict task: offline, from the stored godbolt answers. - name: Our Mojo programs pass run: | if command -v python3 >/dev/null; then python3 core/scripts/mojo/corpus.py status --strict else echo "python3 missing: corpus status skipped"; fi - name: Assemble the site run: scripts/assemble.sh env: GITHUB_SHA: ${{ gitea.sha }} - name: Publish to /srv/www if: gitea.event_name != 'pull_request' && gitea.ref == 'refs/heads/main' env: SLUG: ${{ vars.SITE_SLUG || gitea.event.repository.name }} GITHUB_SHA: ${{ gitea.sha }} run: scripts/deploy.sh "$SLUG" - name: Smoke test if: gitea.event_name != 'pull_request' && gitea.ref == 'refs/heads/main' && vars.SITE_URL != '' env: SITE_URL: ${{ vars.SITE_URL }} GITHUB_SHA: ${{ gitea.sha }} run: | sleep 2 live=$(curl -fsS "$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 ;; esac