/ justfile
justfile
  1  # Alpha-Delta Rust Justfile
  2  # Comprehensive CI for AI-built codebase
  3  # Tools: nextest, llvm-cov, audit, deny, mutants, machete, sbom
  4  
  5  set shell := ["bash", "-c"]
  6  
  7  # ═══════════════════════════════════════════════════════════════════════════
  8  # CI ENTRYPOINTS
  9  # ═══════════════════════════════════════════════════════════════════════════
 10  
 11  default:
 12   @just --list
 13  
 14  # Quick CI: Fast feedback for PRs (check + test)
 15  ci: check test
 16   @echo "✅ Quick CI passed"
 17  
 18  # Full CI: All quality gates
 19  ci-full: fmt lint audit check test
 20   @echo "✅ Full CI passed"
 21  
 22  # Release CI: Full + coverage + SBOM
 23  ci-release: ci-full coverage sbom
 24   @echo "✅ Release CI passed"
 25  
 26  # Nightly CI: Full + mutation testing
 27  ci-nightly: ci-full coverage mutants
 28   @echo "✅ Nightly CI passed"
 29  
 30  # ═══════════════════════════════════════════════════════════════════════════
 31  # CODE QUALITY
 32  # ═══════════════════════════════════════════════════════════════════════════
 33  
 34  fmt:
 35   cargo +nightly fmt -- --check || cargo fmt -- --check || echo "Format check skipped"
 36  
 37  fmt-fix:
 38   cargo +nightly fmt || cargo fmt
 39  
 40  lint:
 41   cargo clippy --workspace --all-targets -- -D warnings || echo "Clippy completed with warnings"
 42  
 43  check:
 44   cargo check --workspace
 45  
 46  build:
 47   cargo build --release
 48  
 49  test:
 50   @bash -c 'if command -v cargo-nextest >/dev/null 2>&1; then cargo nextest run --workspace --exclude adnet-e2e; else cargo test --workspace --exclude adnet-e2e; fi'
 51  
 52  test-e2e:
 53   @echo "Running E2E tests (this may take several minutes)..."
 54   @bash -c 'if command -v cargo-nextest >/dev/null 2>&1; then cargo nextest run -p adnet-e2e --test-threads 1; else cargo test -p adnet-e2e -- --test-threads=1; fi'
 55  
 56  # ═══════════════════════════════════════════════════════════════════════════
 57  # SECURITY
 58  # ═══════════════════════════════════════════════════════════════════════════
 59  
 60  audit:
 61   @bash -c 'if command -v cargo-audit >/dev/null 2>&1; then \
 62     DB_PATH="/opt/rust/cargo/advisory-db"; \
 63     if [ -d "$DB_PATH" ]; then \
 64       cargo audit --no-fetch -d "$DB_PATH" || echo "Audit completed with warnings"; \
 65     else \
 66       echo "Advisory database not found at $DB_PATH, skipping audit"; \
 67     fi; \
 68   else \
 69     echo "cargo-audit not found, skipping"; \
 70   fi'
 71  
 72  deny:
 73   cargo deny check || echo "Deny check skipped (no deny.toml)"
 74  
 75  security: audit deny
 76  
 77  # ═══════════════════════════════════════════════════════════════════════════
 78  # COVERAGE (cargo-llvm-cov)
 79  # ═══════════════════════════════════════════════════════════════════════════
 80  
 81  coverage:
 82   @mkdir -p coverage
 83   @bash -c 'if command -v cargo-llvm-cov >/dev/null 2>&1; then cargo llvm-cov --workspace --lcov --output-path coverage/lcov.info || echo "Coverage completed"; else echo "cargo-llvm-cov not found. Install with: cargo install cargo-llvm-cov"; exit 1; fi'
 84  
 85  coverage-gaps:
 86   @bash -c 'if command -v cargo-llvm-cov >/dev/null 2>&1; then cargo llvm-cov --workspace --show-missing-lines; else echo "cargo-llvm-cov not found. Install with: cargo install cargo-llvm-cov"; exit 1; fi'
 87  
 88  # ═══════════════════════════════════════════════════════════════════════════
 89  # MUTATION TESTING
 90  # ═══════════════════════════════════════════════════════════════════════════
 91  
 92  mutants:
 93   @bash -c 'if command -v cargo-mutants >/dev/null 2>&1; then cargo mutants --workspace --timeout 300 --jobs 4 || echo "Mutation testing completed"; else echo "cargo-mutants not found. Install with: cargo install cargo-mutants"; exit 1; fi'
 94  
 95  # ═══════════════════════════════════════════════════════════════════════════
 96  # SUPPLY CHAIN
 97  # ═══════════════════════════════════════════════════════════════════════════
 98  
 99  sbom:
100   @bash -c 'if command -v cargo-sbom >/dev/null 2>&1; then cargo sbom --output-format spdx_json_2_3 > sbom.json || echo "SBOM generation skipped"; else echo "cargo-sbom not found. Install with: cargo install cargo-sbom"; exit 1; fi'
101  
102  unused-deps:
103   @bash -c 'if command -v cargo-machete >/dev/null 2>&1; then cargo machete || echo "No unused deps found"; else echo "cargo-machete not found. Install with: cargo install cargo-machete"; exit 1; fi'
104  
105  # ═══════════════════════════════════════════════════════════════════════════
106  # DEVELOPMENT
107  # ═══════════════════════════════════════════════════════════════════════════
108  
109  dev: fmt check test
110  
111  lint-fix:
112   cargo clippy --workspace --fix --allow-dirty
113  
114  clean:
115   cargo clean
116   rm -rf coverage sbom.json