From 4a42c896db5ea24e9c8fe796a76e4c08d348d68e Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 2 Dec 2026 15:30:58 -0600 Subject: [PATCH] ci: nix flake check on every push Every check in flake.nix, starting with ir-pico's doctests, in the nixos/nix image, pinned by digest. The checkout is plain git, since actions/checkout needs node and the image has none. Generated-by: Claude Opus 5.5 --- .gitea/workflows/check.yaml | 35 +++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 19 +++++++++++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/check.yaml diff --git a/.gitea/workflows/check.yaml b/.gitea/workflows/check.yaml new file mode 100644 index 0000000..8ac95e8 --- /dev/null +++ b/.gitea/workflows/check.yaml @@ -0,0 +1,35 @@ +name: check + +# nix flake check: every check in flake.nix, such as ir-pico's doctests. +on: + push: + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + # Nix comes from its own image, pinned by digest, not a floating tag: a tag can be moved. + container: + image: nixos/nix:2.35.6@sha256:b49cb33f3a7e5cf3933ad8774529de0e3807ec5cf54987aa7ccdfb49f2fc55ed + env: + # A container can't make the namespaces Nix's build sandbox needs. + NIX_CONFIG: | + experimental-features = nix-command flakes + sandbox = false + steps: + # No actions/checkout: it runs on node, which this image doesn't have, and git does the job. + - name: Check out + env: + SERVER: ${{ gitea.server_url }} + REPO: ${{ gitea.repository }} + REF: ${{ gitea.ref }} + SHA: ${{ gitea.sha }} + # The server won't hand out a bare commit, so fetch the ref that was pushed, then the commit. + run: | + git init -q src + git -C src fetch -q --depth 20 "$SERVER/$REPO.git" "$REF" + git -C src checkout -q --detach "$SHA" + + - name: nix flake check + working-directory: src + run: nix flake check -L diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 365a585..3630b43 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,21 @@ The [README](README.md) says what pdtv26 does and why; this is how to work on it. -## Working on it +## Development -The tools come from the flake: `nix develop --command make test` in any folder, or `nix develop` once and then `make`. `nix flake check` runs every folder's tests. `make help` in each folder lists what it does, and each module's docstring says what it is. Docs are only for what isn't code, such as [wiring](ir-pico/wiring.md). +The tools come from the flake. To run every folder's tests, as [CI](.gitea/workflows/check.yaml) should on each push: + +``` +nix flake check +``` + +To work in one folder: + +``` +cd ir-pico +nix develop +make help +make test +``` + +Each module's docstring says what it is. Docs are only for what isn't code, such as [wiring](ir-pico/wiring.md).