From d9052725a24b2e0787e1b48ee2dd01914efe96de Mon Sep 17 00:00:00 2001 From: MathisWellmann Date: Wed, 22 Jul 2026 12:42:37 +0100 Subject: [PATCH 1/3] flake: add `yamlfmt` and format `ci.yml` --- .github/workflows/ci.yml | 27 +++++---------------------- flake.nix | 1 + mprocs.yaml | 8 -------- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fa6725..1a2115a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,64 +1,47 @@ name: "Rust checks" - on: pull_request: - branches: [ main ] - + branches: [main] permissions: contents: read actions: read - jobs: check: # Target self-hosted runner by label - runs-on: [ nixos ] - + 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 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 . - - +# TODO: enable hongdown +# - name: markdown-formatting +# run: nix develop --command hongdown --check . diff --git a/flake.nix b/flake.nix index ba4940d..dc69fa6 100644 --- a/flake.nix +++ b/flake.nix @@ -73,6 +73,7 @@ tools = with pkgs; [ mprocs # Run multiple commands in parallel from `mprocs.yml`, acting essentially as a local CI system. hongdown.packages.${system}.hongdown + yamlfmt ]; in with pkgs; { diff --git a/mprocs.yaml b/mprocs.yaml index 7b10a3c..2a71d74 100644 --- a/mprocs.yaml +++ b/mprocs.yaml @@ -3,20 +3,17 @@ procs: shell: "cargo check" cargo-check-trade_aggregation: shell: "cargo check --features trade_aggregation" - # Testing cargo-test: shell: "cargo test" cargo-test-trade_aggregation: shell: "cargo test --features trade_aggregation" - cargo-clippy: shell: "cargo clippy" cargo-doc: shell: "cargo doc" cargo-machete: shell: "cargo machete" - # Benchmarking cargo-bench_Position: shell: "cargo bench Position" @@ -60,7 +57,6 @@ procs: cargo-bench_OrderBook/try_insert: shell: "cargo bench OrderBook/try_insert" autostart: false - # Formatting taplo: shell: "taplo fmt" @@ -68,7 +64,6 @@ procs: shell: "cargo fmt" hongdown: shell: "hongdown -w ." - # Code Coverage cargo-tarpaulin: shell: "cargo tarpaulin --target-dir target/tarpaulin" @@ -76,7 +71,6 @@ procs: cargo-mutants: shell: "cargo mutants" autostart: false - # Security cargo-audit: shell: "cargo audit" @@ -84,10 +78,8 @@ procs: cargo-miri: shell: "MIRIFLAGS=-Zmiri-disable-isolation cargo miri nextest run -j 4" autostart: false - # Semantic version check semver-checks: shell: "cargo semver-checks" - basic-example: shell: "cargo run --example basic" From 63ebea111fbcea3a60ddf9c9b2c735ee49e50755 Mon Sep 17 00:00:00 2001 From: MathisWellmann Date: Wed, 22 Jul 2026 12:43:37 +0100 Subject: [PATCH 2/3] CI: run `yamlfmt -lint` --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a2115a..d8fe510 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,8 @@ jobs: run: nix develop --command statix check - name: nix-alejandra run: nix develop --command alejandra --check . + - name: yamlfmt + run: nix develop --command yamlfmt -lint . # TODO: enable hongdown # - name: markdown-formatting From f83bc668eea36cbbb5cc95aa803c34d9a8ab820b Mon Sep 17 00:00:00 2001 From: MathisWellmann Date: Wed, 22 Jul 2026 12:44:54 +0100 Subject: [PATCH 3/3] CI: run clippy, which was passing. --- .github/workflows/ci.yml | 15 ++++++--------- clippy.toml | 1 + 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8fe510..236a947 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,8 @@ on: permissions: contents: read actions: read +env: + RUSTFLAGS: "-D warnings" # Make all warnings deny. jobs: check: # Target self-hosted runner by label @@ -15,18 +17,13 @@ jobs: - name: checkout-code 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-test + # run: nix develop --command cargo test --release + - name: cargo-clippy + 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 diff --git a/clippy.toml b/clippy.toml index ee4f0ba..41eab6d 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,3 +1,4 @@ +allow-unwrap-in-tests = true disallowed-methods = [ # Call `Vec::push_within_capacity` instead as it avoid the footgun of allocations in hot-paths. "std::vec::Vec::push",