Repository navigation
6. CI
The pre-commit.yml workflow runs on push and pull requests to main, release/*, and dev/*.
This workflow contains two jobs:
-
nix-env: Instantiates thecidevelopment shell, applies the Buildroot defconfig, and downloads the Linux kernel source tarball intodl/. The job fails if the Nix environment is broken. Kernel sources provide pre-commit rules for Device Tree files. -
pre-commit: Restoresdl/from cache, then runs all pre-commit hooks via./support/pre-commit.sh. Results are written to the job summary.
If nix-env fails, pre-commit is blocked and the failure is clearly attributed to the environment rather than to a hook.
The build.yml workflow runs on push and pull requests to main and release/*, plus manual dispatch.
This workflow contains four jobs. The release and debug jobs deliberately use the two different build paths, the hermetic nix build and the make shell build, so that both paths are exercised on every run and a regression in either one is caught.
-
lockfile: Verifies the state offlake.lock,buildroot.lock, andtoolchain.lock. It runsnix flake lock --no-update-lock-fileto confirmflake.lockis current, then regenerates both Buildroot locks withmake nix-lockand fails if either committed lock differs. -
toolchain: Builds the toolchain SDK (nix build .#toolchain) and pushes it to Cachix first, so both build paths substitute the same cached SDK. Both build jobs depend on this job. -
image: Builds the release image and SDK through the hermeticnix buildpath. The image build (nix build) consumes the stage-1 toolchain SDK as an external toolchain and builds packages, images, and programmer. The emittedflashlayout.tsvreferences artifacts for use withSTM32_Programmer_CLI. The SDK build (nix build .#sdk) produces a relocatable cross-compiler SDK as a second output of the same derivation, and uses the cache once the image is built. Uses Cachix to cache Nix store paths across runs. Uploads the images and SDK as separate artifacts. -
debug: Builds the debug image through themakeshell path, runningmake debugwith the debug fragment. The development shell'smakeshim resolves the Cachix-cached toolchain SDK automatically, and ccache plus a host cache (keyed ontoolchain.lock) provide incremental reuse across runs.
The template-test.yml workflow runs on push and pull requests to main when files under support/parent/, lib.nix, inputs.nix, nix/, or .pre-commit-hooks.yaml change. It is also available via manual dispatch.
This workflow instantiates the parent template into a scratch directory and runs the same checks that a downstream parent would run on commit. No build occurs; evaluation only.
The template-test job copies the submodule into a temp directory as regular files, runs init.sh to generate the template, then validates:
- All expected template files are created.
- No leftover
@@PLACEHOLDER@@tokens remain. - Hook IDs in
.pre-commit-config.yamlmatch.pre-commit-hooks.yaml. -
nix flake check --no-buildsucceeds (evaluates all derivations without building).
Commit messages are validated against Conventional Commits at push time (via the pre-push git hook) and in CI. They are intentionally not checked on every local commit to allow rebasing and fixups without friction.
To check messages manually:
./support/pre-commit/commitizen-check-push.sh HEAD~3
./support/pre-commit/commitizen-check-push.sh mainThe script re-execs inside nix develop .#pre-commit automatically if cz is not on PATH.
The dl/ directory is cached, keyed on buildroot.lock. The cache accumulates downloaded sources over time and is reused across runs as long as the lock file does not change. As more packages are added (for example for a full build job), their tarballs are included automatically.
act is included in the default development shell and runs GitHub Actions workflows locally via Docker.
act
act -W .github/workflows/pre-commit.yml
act -W .github/workflows/pre-commit.yml -j pre-commitThe first command runs all workflows. The second runs a specific workflow. The third runs a specific job from a workflow.
Act defaults may not suit the build requirements. A local ~/.actrc may require:
--container-daemon-socket $XDG_RUNTIME_DIR/podman/podman.sock
-P ubuntu-latest=catthehacker/ubuntu:act-latest
--container-options --security-opt=seccomp=unconfined
The first option uses Podman instead of Docker. The second selects an ubuntu-latest image similar to the one GitHub Actions uses. The third relaxes the container seccomp profile, which allows the unprivileged user namespaces that buildFHSEnv needs because it relies on bwrap (avoiding running the container fully --privileged).
-
cachix/install-nix-actionprints a warning about running as root inside the Act container. This is cosmetic; Nix installs and works correctly. -
actions/cache@v5will not use cache from GitHub. This may work differently depending on local configuration. - Use
act -s ACTIONS_RUNTIME_TOKEN=localto skip steps that upload artifacts.
The ci development shell (nix develop .#ci) contains all packages needed to run Buildroot builds in CI. It is identical to the default shell minus tools that require manual setup or are local-only:
-
stm32cubeprogrequires a manually downloaded ST zip and cannot be fetched automatically. -
actandpodmanare local workflow tooling, not needed in CI.
Use .#ci in any CI step that invokes make. Use .#default locally for the full development environment including flashing tools.
To enter the CI shell locally (for example to reproduce a CI-specific environment failure):
nix develop .#ci- Use
nix develop .#ci --command <cmd>for steps that need the Buildroot environment. - Use
nix develop .#pre-commit --command <cmd>for lint and hook steps. - Add
dl/to the cache if the job downloads sources; key onbuildroot.lock. - If a job depends on the Nix environment being valid, add
needs: nix-envto make the dependency explicit.