/ 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  # CI environments have read-only /opt/rust - use writable locations
  8  # CARGO_HOME is needed for cargo audit advisory-db and other tools that need to write
  9  export CARGO_HOME := "/var/tmp/cargo"
 10  export TMPDIR := "/var/tmp"
 11  export TEMP := "/var/tmp"
 12  export TMP := "/var/tmp"
 13  
 14  # sccache configuration - use /var/tmp since /opt/ci is read-only in CI
 15  # sccache is conditionally enabled in CI via GITHUB_ENV if available
 16  export SCCACHE_DIR := "/var/tmp/sccache"
 17  export SCCACHE_CACHE_SIZE := "10G"
 18  
 19  # ═══════════════════════════════════════════════════════════════════════════
 20  # CI ENTRYPOINTS
 21  # ═══════════════════════════════════════════════════════════════════════════
 22  
 23  default:
 24      @just --list
 25  
 26  # Quick CI: Fast feedback for PRs (check + test)
 27  ci: check test
 28      @echo "✅ Quick CI passed"
 29  
 30  # Full CI: All quality gates
 31  ci-full: fmt lint audit check build test
 32      @echo "✅ Full CI passed"
 33  
 34  # Release CI: Full + coverage + SBOM
 35  ci-release: ci-full coverage sbom
 36      @echo "✅ Release CI passed"
 37  
 38  # Nightly CI: Full + mutation testing
 39  ci-nightly: ci-full coverage mutants
 40      @echo "✅ Nightly CI passed"
 41  
 42  # ═══════════════════════════════════════════════════════════════════════════
 43  # CODE QUALITY
 44  # ═══════════════════════════════════════════════════════════════════════════
 45  
 46  fmt:
 47      cargo +nightly fmt --all -- --check
 48  
 49  lint:
 50      cargo clippy --workspace --all-targets -- -D warnings || echo "Clippy completed with warnings"
 51  
 52  check:
 53      cargo check --workspace
 54  
 55  build:
 56      cargo build --release
 57  
 58  test:
 59      cargo nextest run --workspace --exclude alphavm-wasm --release --failure-output immediate --test-threads 8 || cargo test --workspace --exclude alphavm-wasm --release -- --test-threads=8
 60  
 61  # ═══════════════════════════════════════════════════════════════════════════
 62  # SECURITY
 63  # ═══════════════════════════════════════════════════════════════════════════
 64  
 65  audit:
 66      cargo audit || echo "Audit completed with warnings"
 67  
 68  deny:
 69      cargo deny check || echo "Deny check skipped (no deny.toml)"
 70  
 71  security: audit deny
 72  
 73  # ═══════════════════════════════════════════════════════════════════════════
 74  # COVERAGE (cargo-llvm-cov)
 75  # ═══════════════════════════════════════════════════════════════════════════
 76  
 77  coverage:
 78      mkdir -p coverage
 79      cargo llvm-cov --workspace --exclude alphavm-wasm --release --lcov --output-path coverage/lcov.info || echo "Coverage completed"
 80  
 81  coverage-gaps:
 82      cargo llvm-cov --workspace --exclude alphavm-wasm --release --show-missing-lines
 83  
 84  # ═══════════════════════════════════════════════════════════════════════════
 85  # MUTATION TESTING
 86  # ═══════════════════════════════════════════════════════════════════════════
 87  
 88  mutants:
 89      cargo mutants --workspace --exclude alphavm-wasm --timeout 300 --in-place || echo "Mutation testing completed"
 90  
 91  # ═══════════════════════════════════════════════════════════════════════════
 92  # SUPPLY CHAIN
 93  # ═══════════════════════════════════════════════════════════════════════════
 94  
 95  sbom:
 96      cargo sbom --output-format spdx_json_2_3 > sbom.json || echo "SBOM generation skipped"
 97  
 98  unused-deps:
 99      cargo machete || echo "No unused deps found"
100  
101  # ═══════════════════════════════════════════════════════════════════════════
102  # DEVELOPMENT
103  # ═══════════════════════════════════════════════════════════════════════════
104  
105  dev: fmt check test
106  
107  fmt-fix:
108      cargo +nightly fmt --all
109  
110  lint-fix:
111      cargo clippy --workspace --fix --allow-dirty
112  
113  clean:
114      cargo clean
115      rm -rf coverage sbom.json