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..fb132fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,4 +4,4 @@ The [README](README.md) says what pdtv26 does and why; this is how to work on it ## Working on it -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: `nix develop --command make test` in any folder, or `nix develop` once and then `make`. `nix flake check` runs every folder's tests, and [CI](.gitea/workflows/check.yaml) should run it on each push. `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).