From 2971282d08bfefa015d3c6e23d19d29bce015320 Mon Sep 17 00:00:00 2001 From: MathisWellmann Date: Fri, 23 Jan 2026 14:21:18 +0000 Subject: [PATCH 1/2] CI: introduce first CI workflow --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0726bfb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: "Rust checks" + +on: + pull_request: + branches: [ main ] + +permissions: + contents: read + actions: read + +jobs: + check: + # Target self-hosted runner by label + runs-on: [ nixos ] + + # SECURITY: Require manual approval for external PRs + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} + + steps: + - name: checkout-code + uses: actions/checkout@v4 + + - name: cargo-check + run: nix develop --command cargo check + From 9901cdc7999130c8e72f216cffa6b3ef31186635 Mon Sep 17 00:00:00 2001 From: MathisWellmann Date: Thu, 5 Feb 2026 12:09:40 +0000 Subject: [PATCH 2/2] CI: add a bunch more steps --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ flake.nix | 6 ++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0726bfb..6fa6725 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,5 +21,44 @@ jobs: uses: actions/checkout@v4 - name: cargo-check + env: + RUSTFLAGS: "-D warnings" # Make all warnings deny. run: nix develop --command cargo check + - name: cargo-test + env: + RUSTFLAGS: "-D warnings" # Make all warnings deny. + run: nix develop --command cargo test + + # TODO: make clippy work + # - name: cargo-clippy + # env: + # RUSTFLAGS: "-D warnings" # Make all warnings deny. + # run: nix develop --command cargo clippy + + - name: cargo-bench + run: nix develop --command cargo bench --no-run # Just to make sure it compiles + + - name: cargo-fmt + run: nix develop --command cargo fmt --check + + - name: cargo-doc + run: nix develop --command cargo doc + + - name: nix-flake-check + run: nix flake check + + - name: nix-deadnix + run: nix develop --command deadnix + + - name: nix-statix + run: nix develop --command statix check + + - name: nix-alejandra + run: nix develop --command alejandra --check . + + # TODO: enable hongdown + # - name: markdown-formatting + # run: nix develop --command hongdown --check . + + diff --git a/flake.nix b/flake.nix index 638b299..cdf759a 100644 --- a/flake.nix +++ b/flake.nix @@ -55,7 +55,6 @@ with pkgs; { devShells.default = mkShell { buildInputs = [ - (lib.hiPrio rust-bin.nightly."2025-02-01".rustfmt) rust cargo-nextest cargo-semver-checks @@ -64,7 +63,10 @@ cargo-tarpaulin # Code coverage cargo-audit cargo-machete - taplo + taplo # Format `.toml` files. + deadnix # Nix dead code checker + alejandra # Nix code formatter. + statix # Nix static code checker. mprocs # Run multiple commands in parallel from `mprocs.yml`, acting essentially as a local CI system. hongdown.packages.${system}.hongdown creusot # Execute with `cargo creusot`