Skip to content
Merged

Ci #22

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 13 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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 .
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; {
Expand Down
8 changes: 0 additions & 8 deletions mprocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -60,34 +57,29 @@ procs:
cargo-bench_OrderBook/try_insert:
shell: "cargo bench OrderBook/try_insert"
autostart: false

# Formatting
taplo:
shell: "taplo fmt"
cargo-fmt:
shell: "cargo fmt"
hongdown:
shell: "hongdown -w ."

# Code Coverage
cargo-tarpaulin:
shell: "cargo tarpaulin --target-dir target/tarpaulin"
# Mutation testing
cargo-mutants:
shell: "cargo mutants"
autostart: false

# Security
cargo-audit:
shell: "cargo audit"
# Undefined behaviour checking
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"
Loading