diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fa6725..236a947 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,64 +1,46 @@ name: "Rust checks" - on: pull_request: - branches: [ main ] - + branches: [main] permissions: contents: read actions: read - +env: + RUSTFLAGS: "-D warnings" # Make all warnings deny. 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-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 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 . + - name: yamlfmt + run: nix develop --command yamlfmt -lint . - # 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/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", 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"