Files
alexm e5ae0904cf
Test (in pplus-core) / in-core (push) Canceled after 0s
CI: run core's gate on the heavy runner, not the deploy server
The gate builds and runs some 300 Mojo programs and fuzzes. The workflow
now asks for the runner labeled heavy (pplus-core's docs/ci.md has its
setup); with none registered a run waits. Its comments described a
host-mode runner that was never what ran it.
2026-11-13 06:10:37 -05:00

113 lines
5.7 KiB
YAML

# pplus-library's gate. The library is data; its checks are pplus-core's tasks, run from a core checkout where the
# library is `library/` (AGENTS.md). So this checks out core's default branch, puts this commit of the library where
# core's submodule goes, does what core does when it takes a new library (moves its pointer, in this throwaway
# checkout only, and regenerates what it derives: library-emit, mojo-emit), and runs core's whole gate, `pixi run ci`.
#
# What a green run shows: core's default branch, given this library and what core regenerates from it, passes every
# test, mojo-status-strict, library-check (every routine at every level), mojo-local and the short fuzz. What it does
# not show: that core pins this commit (that is a commit in core, made after this one is pushed; pplus-web's
# release-check task checks the chain), that web works with it, or anything about a core branch other than the
# default one. A red run can be core's own: look at core's latest run first. The repository variable CORE_REF, when
# set, names another ref of core to test against (a branch made for the same change).
#
# Gitea Actions, on the runner with the label `heavy`, as pplus-core's own gate (its docs/ci.md has the runner's
# setup): the gate builds and runs some 300 Mojo programs, so it never runs on the server that deploys the site, and
# with no `heavy` runner registered a run waits. On GitHub Actions the same file runs with `runs-on: ubuntu-latest`.
# core is read from the same owner on the same server as this repository.
name: Test (in pplus-core)
on:
push:
pull_request:
workflow_dispatch:
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
env:
CI: "true"
PIXI_VERSION: "0.83.0"
jobs:
in-core:
# a pull request runs only from a branch of this repository: a fork's workflow would run its own code on the
# runner (docs/ci.md in pplus-core). Drop this line for a runner that is a throwaway machine.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: heavy
timeout-minutes: 60
steps:
- name: pplus-core, its default branch (or CORE_REF)
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/pplus-core
ref: ${{ vars.CORE_REF }}
path: core
- name: This commit of pplus-library, where core's submodule goes
uses: actions/checkout@v4
with:
path: core/library
# pixi: the runner's when it is the pinned version, else the pinned release, fetched into a cache directory
# (which lasts only where the runner keeps a home between jobs) and checked by SHA-256
- name: pixi, pinned
shell: bash
working-directory: core
run: |
set -euo pipefail
if command -v pixi >/dev/null && [ "$(pixi --version | cut -d' ' -f2)" = "$PIXI_VERSION" ]; then
echo "pixi $PIXI_VERSION is on the PATH: $(command -v pixi)"; exit 0
fi
dir="${PPLUS_CI_CACHE:-$HOME/.cache/pplus-ci}/pixi-$PIXI_VERSION"
if [ ! -x "$dir/pixi" ]; then
case "$(uname -s)-$(uname -m)" in
Linux-x86_64) asset=pixi-x86_64-unknown-linux-musl.tar.gz; sum=064f371e692aaa3400ac581c89da2843c91437f20c2d9155395a5d0037f33551 ;;
Linux-aarch64) asset=pixi-aarch64-unknown-linux-musl.tar.gz; sum=d08403d8f048626ec93ba7b7c56e3b747a5f3a95c4e6e0c815ceb264f5f0b9ce ;;
*) echo "no pinned pixi for $(uname -sm)" >&2; exit 1 ;;
esac
tmp="$(mktemp -d)"
curl -fsSL --retry 3 -o "$tmp/$asset" "https://github.com/prefix-dev/pixi/releases/download/v$PIXI_VERSION/$asset"
echo "$sum $tmp/$asset" | sha256sum -c -
mkdir -p "$dir" && tar -xzf "$tmp/$asset" -C "$dir" pixi && rm -rf "$tmp"
fi
echo "$dir" >> "$GITHUB_PATH"
"$dir/pixi" --version
- name: The pinned environment, exactly as core's pixi.lock has it
working-directory: core
run: pixi install --locked
# .tools/ (the pinned Dafny, mojo-local's answers) in the runner's cache, as in pplus-core's own workflow
- name: The pinned Dafny
working-directory: core
shell: bash
run: |
set -euo pipefail
cache="${PPLUS_CI_CACHE:-$HOME/.cache/pplus-ci}/core-tools"
mkdir -p "$cache"
if [ -d .tools ] && [ ! -L .tools ]; then echo ".tools is a directory in this checkout already: using it"; else ln -sfn "$cache" .tools; fi
pixi run dafny-fetch
# what pplus-web's release-bump task does in core when the library moves; the commit stays on this runner
- name: Core takes this library
working-directory: core
shell: bash
run: |
set -euo pipefail
echo "core $(git rev-parse --short HEAD) pinned library $(git rev-parse --short HEAD:library); this library is $(git -C library rev-parse --short HEAD)"
pixi run library-emit
pixi run mojo-emit
git add library src/library/generated.ts src/mojo/generated
git -c user.name=CI -c user.email=ci@invalid -c commit.gpgsign=false commit -q --allow-empty -m "CI: take pplus-library $(git -C library rev-parse --short HEAD)"
git -C library diff --stat --exit-code || { echo "mojo-emit changed the library: commit what it writes (pixi run mojo-emit in core)" >&2; exit 1; }
- name: pixi run ci (core's gate, with this library)
working-directory: core
run: pixi run ci
- name: Nothing the gate regenerates differs from what this commit holds
working-directory: core
shell: bash
run: |
set -euo pipefail
git -C library diff --stat --exit-code