diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7d813cd8..172c2a63c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,8 @@ concurrency: cancel-in-progress: true env: - # Pass additional arguments to cargo using `--config build.rustflags=["...", "..."]`. - # - # This ensures that we do not overwrite the parameters in `.cargo/config.toml` unnecessarily. - RUST_CONFIG: 'build.rustflags=["-Dwarnings"]' + # Append to target-specific rustflags without replacing `.cargo/config.toml` settings. + RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]' RUST_BACKTRACE: 1 CARGO_TERM_COLOR: always @@ -141,6 +139,8 @@ jobs: - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - name: "clippy --workspace --all-targets" run: cargo clippy --locked --workspace --all-targets --no-deps --config "$RUST_CONFIG" -- -Dwarnings + - name: "clippy --workspace --all-targets --release" + run: cargo clippy --locked --workspace --all-targets --no-deps --release --config "$RUST_CONFIG" -- -Dwarnings clippy-features: strategy: @@ -157,13 +157,24 @@ jobs: - name: Install Rust run: rustup show && rustup component add clippy - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - - name: "clippy --workspace --all-targets" + - name: "clippy --workspace --all-targets --all-features" + run: | + set -euxo pipefail + cargo clippy --locked --workspace \ + --all-targets \ + --all-features \ + --no-deps \ + --config "$RUST_CONFIG" \ + -- -Dwarnings + + - name: "clippy --workspace --all-targets --all-features --release" run: | set -euxo pipefail cargo clippy --locked --workspace \ --all-targets \ --all-features \ --no-deps \ + --release \ --config "$RUST_CONFIG" \ -- -Dwarnings @@ -205,6 +216,13 @@ jobs: --no-deps \ --config "$RUST_CONFIG" \ -- -Dwarnings + cargo clippy --locked --package "$crate" \ + --no-default-features \ + --all-targets \ + --release \ + --no-deps \ + --config "$RUST_CONFIG" \ + -- -Dwarnings done codeql: @@ -229,7 +247,7 @@ jobs: - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - name: Build workspace - run: cargo build --workspace --locked --profile test + run: cargo build --workspace --locked --profile test --config "$RUST_CONFIG" - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 @@ -245,9 +263,9 @@ jobs: run: rustup show - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - name: "workspace docs (including private items)" - run: cargo doc --locked --workspace --no-deps --all-features --document-private-items + run: cargo doc --locked --workspace --no-deps --all-features --document-private-items --config "$RUST_CONFIG" env: - RUSTDOCFLAGS: -D rustdoc::all + RUSTDOCFLAGS: -Dwarnings -D rustdoc::all vectorset-fmt: name: vectorset format check @@ -284,6 +302,10 @@ jobs: run: | cd vectorset cargo clippy --locked --all-targets --no-deps --config "$RUST_CONFIG" -- -Dwarnings + - name: "vectorset: clippy --all-targets --release" + run: | + cd vectorset + cargo clippy --locked --all-targets --no-deps --config "$RUST_CONFIG" --release -- -Dwarnings vectorset-build: strategy: @@ -302,8 +324,8 @@ jobs: - name: "vectorset: build debug & release" run: | cd vectorset - cargo build --locked - cargo build --locked --release + cargo build --locked --config "$RUST_CONFIG" + cargo build --locked --release --config "$RUST_CONFIG" # Test micro-architecture detection and dispatching. # @@ -428,7 +450,7 @@ jobs: - name: "SDE Tests (AVX-512)" run: | set -euxo pipefail - cargo test --locked \ + cargo test --locked --config "$RUST_CONFIG" \ --package diskann-wide \ --package diskann-vector \ --package diskann-quantization \ @@ -538,7 +560,7 @@ jobs: - name: Generate miri code coverage env: - RUSTFLAGS: "--cfg=miri" + RUSTFLAGS: "-Dwarnings --cfg=miri" run: | cargo +nightly llvm-cov nextest --locked \ --package diskann-quantization \ @@ -599,11 +621,11 @@ jobs: - name: Generate baseline LLVM lines working-directory: baseline - run: cargo llvm-lines --package diskann-benchmark --all-features --release | head -100 | tee ../baseline-llvm-lines.txt + run: cargo llvm-lines --package diskann-benchmark --all-features --release --config "$RUST_CONFIG" | head -100 | tee ../baseline-llvm-lines.txt - name: Generate current LLVM lines working-directory: pr - run: cargo llvm-lines --package diskann-benchmark --all-features --release | head -100 | tee ../current-llvm-lines.txt + run: cargo llvm-lines --package diskann-benchmark --all-features --release --config "$RUST_CONFIG" | head -100 | tee ../current-llvm-lines.txt - name: Compare LLVM lines run: bash pr/.github/scripts/compare-llvm-lines.sh baseline-llvm-lines.txt current-llvm-lines.txt diff --git a/.github/workflows/disk-benchmarks-aa.yml b/.github/workflows/disk-benchmarks-aa.yml index da7725d91..95dae868d 100644 --- a/.github/workflows/disk-benchmarks-aa.yml +++ b/.github/workflows/disk-benchmarks-aa.yml @@ -22,6 +22,7 @@ concurrency: cancel-in-progress: true env: + RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]' RUST_BACKTRACE: 1 PERF_INPUTS: diskann-benchmark/perf_test_inputs @@ -82,26 +83,26 @@ jobs: # A/A: build once, run twice (identical code — only detecting environment noise) - name: Build benchmark binary working-directory: diskann_rust - run: cargo build -p diskann-benchmark --features disk-index --release + run: cargo build -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" - name: Run baseline benchmark working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ run --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ --output-file target/tmp/${{ matrix.dataset }}_baseline.json - name: Run target benchmark working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ run --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ --output-file target/tmp/${{ matrix.dataset }}_target.json - name: Validate benchmark results working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ check run \ --tolerances ${{ env.PERF_INPUTS }}/disk-index-tolerances.json \ --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ diff --git a/.github/workflows/disk-benchmarks.yml b/.github/workflows/disk-benchmarks.yml index dded68a15..8699eba26 100644 --- a/.github/workflows/disk-benchmarks.yml +++ b/.github/workflows/disk-benchmarks.yml @@ -41,6 +41,7 @@ concurrency: cancel-in-progress: true env: + RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]' RUST_BACKTRACE: 1 PERF_INPUTS: diskann-benchmark/perf_test_inputs @@ -117,21 +118,21 @@ jobs: - name: Run baseline benchmark working-directory: baseline run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ run --input-file ../diskann_rust/${{ env.PERF_INPUTS }}/${{ matrix.config }} \ --output-file target/tmp/${{ matrix.dataset }}_baseline.json - name: Run current branch benchmark working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ run --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ --output-file target/tmp/${{ matrix.dataset }}_target.json - name: Validate benchmark results working-directory: diskann_rust run: | - cargo run -p diskann-benchmark --features disk-index --release -- \ + cargo run -p diskann-benchmark --features disk-index --release --config "$RUST_CONFIG" -- \ check run \ --tolerances ${{ env.PERF_INPUTS }}/disk-index-tolerances.json \ --input-file ${{ env.PERF_INPUTS }}/${{ matrix.config }} \ diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4e115ae11..49bf9e143 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true env: - RUST_CONFIG: 'build.rustflags=["-Dwarnings"]' + RUST_CONFIG: 'target."cfg(all())".rustflags=["-Dwarnings"]' RUST_BACKTRACE: 1 CARGO_TERM_COLOR: always