Files
pplus-core/.gitea/workflows/test.yml
T
alexm 401084bab3
Test / gate (push) Failing after 19m0s
Initial commit
2026-11-12 22:23:54 -05:00

86 lines
4.1 KiB
YAML

# pplus-core's gate on every push and pull request: `pixi run ci`, the same task a developer runs, in the
# environment pixi.lock pins (Node, Python, the Mojo compiler), so CI and a developer cannot drift. docs/ci.md says
# what it runs, how long it takes, and what to do when it fails.
#
# Gitea Actions, on a runner in host mode (no container: steps run on the host's shell; pplus-web's docs/deploy.md
# has the runner's setup). The same file runs on GitHub Actions with one change: `runs-on: ubuntu-latest`.
name: Test
on:
push:
pull_request:
workflow_dispatch:
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
env:
# set by Gitea and GitHub Actions already; written here so the tests' "fail, not skip, under CI" never depends on it
CI: "true"
# the pixi that reads pixi.lock; when the host has another version, this one is fetched into the cache below
PIXI_VERSION: "0.83.0"
jobs:
gate:
# a pull request runs only from a branch of this repository: on a host runner a fork's workflow would run its
# own code on the droplet (docs/deploy.md in pplus-web). Drop this line for a runner that is a throwaway VM.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: quarto-deploy
timeout-minutes: 60
steps:
# library/ is pplus-library, a submodule pinned by commit: the programs, the corpus, the routines
- uses: actions/checkout@v4
with:
submodules: recursive
# pixi: the host's when it is the pinned version, else the pinned release, fetched once into a cache directory
# the runner's user owns (no sudo), checked by SHA-256
- name: pixi, pinned
shell: bash
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 host: $(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 pixi.lock has it
run: pixi install --locked
# .tools/ holds the pinned Dafny and mojo-local's answers (keyed by compiler, arguments and source); on a host
# runner it lives in the cache directory, so neither is fetched or built again on every push
- name: The pinned Dafny
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
# every test, mojo-status-strict, library-check, mojo-local and a short mojo-fuzz and prove-fuzz (pixi.toml)
- name: pixi run ci
run: pixi run ci
# the gate rewrites what it records (the library's status.json and STATUS.md, the corpus's STATUS.md); a
# difference means a change was committed without what it regenerates
- name: Nothing the gate regenerates differs from what is committed
shell: bash
run: |
set -euo pipefail
git diff --stat --exit-code
git -C library diff --stat --exit-code