ci: actually schedule nix-checks on the host runner
The workflow could never run: it asked for 'runs-on: ubuntu-latest', but the only runner (gitea-runner-ci-sapphira) advertises exactly one label, 'native' (host executor). test-runner.yml used 'native' and runs; nix-checks never produced a single run. - runs-on: native - drop cachix/install-nix-action and 'nix profile install sops': the host profile already provides nix, sops, git and python3 - evaluate sapphira with 'nix eval --raw ...toplevel.drvPath' instead of 'nix build --dry-run': the runner user is not a Nix trusted user, so a dry-run build would want store write access; evaluation is the actual gate - timeout 15 min, concurrency cancel-in-progress
This commit is contained in:
1 parent
61c5f01b4b
commit
1c11079833
1 file changed
+28
-17
@@ -5,6 +5,12 @@ name: nixos flake checks
|
|||||||
# .gitea/workflows/ in preference to .github/workflows/. The copy that used
|
# .gitea/workflows/ in preference to .github/workflows/. The copy that used
|
||||||
# to sit under .github/workflows/ therefore never ran a single step.
|
# to sit under .github/workflows/ therefore never ran a single step.
|
||||||
# See .agent/tasks/manifest.md T39.
|
# See .agent/tasks/manifest.md T39.
|
||||||
|
#
|
||||||
|
# The only runner is gitea-runner-ci-sapphira, a *host-mode* executor on the
|
||||||
|
# machine this repo configures. It advertises exactly one label: `native`
|
||||||
|
# (`labels = [ "native:host" ]` in modules/server/gitea-runner.nix).
|
||||||
|
# Therefore `runs-on: ubuntu-latest` can never be scheduled — the job stays
|
||||||
|
# unassigned forever. Do not change this label unless the runner does.
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -13,36 +19,41 @@ on:
|
|||||||
branches: [main, dev, master]
|
branches: [main, dev, master]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# The only runner is the host itself: gitea-runner-ci-sapphira on a 2-core /
|
# The runner is the host itself (2 cores / 5.6 GiB, ~20 production services).
|
||||||
# 5.6 GiB machine that also runs ~20 production services. Evaluating all seven
|
# Evaluating all seven configurations cost 40+ minutes and pushed the host
|
||||||
# configurations costs 40+ minutes and pushes the host into swap, so queueing
|
# into swap, so superseded runs are cancelled instead of queued.
|
||||||
# superseded runs is actively harmful — cancel them.
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: nix-checks-${{ github.ref }}
|
group: nix-checks-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
invariant-checks:
|
invariant-checks:
|
||||||
runs-on: ubuntu-latest
|
runs-on: native
|
||||||
# sapphira evaluation is a few minutes on an idle host. This is a
|
# sapphira evaluation is a few minutes on an idle host. Hung-evaluation
|
||||||
# hung-evaluation guard, not a budget; the job used to allow 45.
|
# guard, not a budget (this used to allow 45).
|
||||||
timeout-minutes: 20
|
timeout-minutes: 15
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: cachix/install-nix-action@v27
|
# nix, git, sops and python3 are already provided by the host profile;
|
||||||
with:
|
# installing nix again inside the runner is wasted network + time.
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
- name: toolchain probe
|
||||||
- name: install sops
|
run: |
|
||||||
run: nix profile install nixpkgs#sops
|
nix --version
|
||||||
|
python3 --version
|
||||||
|
git --version
|
||||||
- name: run invariant checks (no full flake check)
|
- name: run invariant checks (no full flake check)
|
||||||
# `--no-build` skips check #2 (`nix flake check`), which evaluates
|
# `--no-build` skips check #2 (`nix flake check`), which evaluates
|
||||||
# every host output. The runner *is* sapphira, so that sweep is both
|
# every host output. The runner *is* sapphira, so that sweep is both
|
||||||
# slow and self-harming here. It can still be run deliberately on a
|
# slow and self-harming here. It can still be run deliberately on a
|
||||||
# beefier machine, or locally with `bash .ci/checks.sh`.
|
# beefier machine, or locally with `bash .ci/checks.sh`.
|
||||||
run: bash .ci/checks.sh --no-build
|
run: bash .ci/checks.sh --no-build
|
||||||
# Only sapphira is evaluated on CI: it is the host this runner lives on,
|
# Only sapphira is evaluated on CI: it is the host the runner lives on,
|
||||||
# so a broken sapphira is an immediate CI-runner outage. Changes that
|
# so a broken sapphira is an immediate CI-runner outage. Evaluation only
|
||||||
# touch another host must be verified explicitly for that host:
|
# (`drvPath`), not a build - the runner user is not a Nix trusted user
|
||||||
|
# and `nix build --dry-run` would still want store write access.
|
||||||
|
# Changes touching another host must be verified explicitly:
|
||||||
# nix build --no-link --dry-run .#nixosConfigurations.<host>.config.system.build.toplevel
|
# nix build --no-link --dry-run .#nixosConfigurations.<host>.config.system.build.toplevel
|
||||||
- name: evaluate the sapphira configuration
|
- name: evaluate the sapphira configuration
|
||||||
run: nix build --no-link --dry-run .#nixosConfigurations.sapphira.config.system.build.toplevel
|
run: |
|
||||||
|
nix --extra-experimental-features "nix-command flakes" eval --raw \
|
||||||
|
'.#nixosConfigurations.sapphira.config.system.build.toplevel.drvPath'
|
||||||
Reference in new issue
Block a user