-
Notifications
You must be signed in to change notification settings - Fork 369
Add CI workflow for Rust project #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9dfb022
Initial plan
Copilot 86b8916
Add comprehensive CI workflow for Rust project
Copilot e755ed1
Fix indentation and use cargo fmt instead of rustfmt directly
Copilot 240338b
Address review feedback: comment out docs, add bf_tree cfg, use miri …
Copilot f7252d3
Use the correct `cfg` guard.
8843d58
Try fixing miri and tests.
66f6d74
More CI edits.
01f17f6
Pull in LFS stored files.
840d121
Try a profile with more optimizations.
e8436d1
Loosen a test for CI.
38196ad
Fix error bounds for non-AVX2 machines.
5c82c69
Fix doc tests.
63e3953
Also run CI tests with more features.
753c0c2
Address NaN handling issue from a CI machine.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [profile.default] | ||
|
|
||
| # terminate the test run it takes more than 10 minutes. | ||
| slow-timeout = { period = "600s", terminate-after = 1 } | ||
|
|
||
| # "retries" defines the number of times a test should be retried. | ||
| retries = 3 | ||
|
|
||
| # The number of threads to run tests with. | ||
| test-threads = "num-cpus" | ||
|
|
||
| # The number of threads required for each test. | ||
| threads-required = 1 | ||
|
|
||
| # Show these test statuses in the output. | ||
| status-level = "all" | ||
|
|
||
| # Similar to status-level, show these test statuses at the end of the run. | ||
| final-status-level = "flaky" | ||
|
|
||
| # "failure-output" defines when standard output and standard error for failing tests are produced. | ||
| failure-output = "immediate" | ||
|
|
||
| # "success-output" controls production of standard output and standard error on success. | ||
| success-output = "never" | ||
|
|
||
| # Cancel the test run on the first failure. For CI runs, this should be false. | ||
| fail-fast = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,231 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT license. | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| branches: ["main"] | ||
|
|
||
| name: CI | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| RUSTFLAGS: -Dwarnings | ||
| RUST_BACKTRACE: 1 | ||
| # Use the Rust version specified in rust-toolchain.toml | ||
| rust_stable: "1.90" | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # Basic checks that must pass before we kick off more expensive tests. | ||
| basics: | ||
| name: basic checks | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - clippy | ||
| - fmt | ||
| # TODO: Re-enable docs check later | ||
| # - docs | ||
| steps: | ||
| - run: exit 0 | ||
|
|
||
| fmt: | ||
| name: format check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust ${{ env.rust_stable }} | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: ${{ env.rust_stable }} | ||
| components: rustfmt | ||
| - uses: Swatinem/rust-cache@v2 | ||
| # Check fmt | ||
| - name: "cargo fmt --check" | ||
| run: | | ||
| if ! cargo fmt --all --check; then | ||
| printf "Please run \`cargo fmt --all\` to fix rustfmt errors.\n" >&2 | ||
| exit 1 | ||
| fi | ||
| clippy: | ||
| name: clippy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust ${{ env.rust_stable }} | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: ${{ env.rust_stable }} | ||
| components: clippy | ||
| - uses: Swatinem/rust-cache@v2 | ||
| # Run clippy on workspace | ||
| - name: "clippy --workspace --all-targets" | ||
| run: cargo clippy --workspace --all-targets --no-deps | ||
|
|
||
| # TODO: Re-enable docs check later | ||
| # docs: | ||
| # name: docs | ||
| # runs-on: ubuntu-latest | ||
| # steps: | ||
| # - uses: actions/checkout@v4 | ||
| # - name: Install Rust ${{ env.rust_stable }} | ||
| # uses: dtolnay/rust-toolchain@stable | ||
| # with: | ||
| # toolchain: ${{ env.rust_stable }} | ||
| # - uses: Swatinem/rust-cache@v2 | ||
| # - name: "doc --workspace --no-deps" | ||
| # run: cargo doc --workspace --no-deps --document-private-items | ||
| # env: | ||
| # RUSTDOCFLAGS: -Dwarnings | ||
|
|
||
| test-workspace: | ||
| needs: basics | ||
| name: test workspace | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - windows-latest | ||
| - ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| lfs: true | ||
|
|
||
| - name: Install Rust ${{ env.rust_stable }} | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: ${{ env.rust_stable }} | ||
|
|
||
| - name: Install cargo-nextest | ||
| uses: taiki-e/install-action@v2 | ||
| with: | ||
| tool: cargo-nextest | ||
|
|
||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: test workspace with nextest | ||
| run: | | ||
| set -euxo pipefail | ||
| cargo nextest run --workspace --cargo-profile ci | ||
| cargo test --doc --workspace --profile ci | ||
| test-workspace-features: | ||
| needs: basics | ||
| name: test workspace | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - windows-latest | ||
| - ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| lfs: true | ||
|
|
||
| - name: Install Rust ${{ env.rust_stable }} | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: ${{ env.rust_stable }} | ||
|
|
||
| - name: Install cargo-nextest | ||
| uses: taiki-e/install-action@v2 | ||
| with: | ||
| tool: cargo-nextest | ||
|
|
||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: test workspace with nextest | ||
| run: | | ||
| set -euxo pipefail | ||
| cargo nextest run --workspace --cargo-profile ci \ | ||
| --features \ | ||
| virtual_storage,bf_tree,spherical-quantization,product-quantization,tracing,experimental_diversity_search | ||
| cargo test --doc --workspace --profile ci | ||
| # coverage: | ||
| # needs: basics | ||
| # name: code coverage | ||
| # runs-on: ubuntu-latest | ||
| # steps: | ||
| # - uses: actions/checkout@v4 | ||
| # with: | ||
| # lfs: true | ||
|
|
||
| # - name: Install Rust ${{ env.rust_stable }} | ||
| # uses: dtolnay/rust-toolchain@stable | ||
| # with: | ||
| # toolchain: ${{ env.rust_stable }} | ||
| # components: llvm-tools-preview | ||
|
|
||
| # - name: Install cargo-llvm-cov | ||
| # uses: taiki-e/install-action@v2 | ||
| # with: | ||
| # tool: cargo-llvm-cov | ||
|
|
||
| # - name: Install cargo-nextest | ||
| # uses: taiki-e/install-action@v2 | ||
| # with: | ||
| # tool: cargo-nextest | ||
|
|
||
| # - uses: Swatinem/rust-cache@v2 | ||
| # - name: Generate code coverage | ||
| # run: | | ||
| # cargo llvm-cov nextest --cargo-profile ci \ | ||
| # --package diskann-wide \ | ||
| # --package diskann-vector \ | ||
| # --package diskann-quantization \ | ||
| # --package diskann \ | ||
| # --package diskann-linalg \ | ||
| # --package diskann-utils \ | ||
| # --package diskann-disk \ | ||
| # --lcov --output-path lcov.info | ||
|
|
||
| # - name: Upload coverage to Codecov | ||
| # uses: codecov/codecov-action@v4 | ||
| # with: | ||
| # files: lcov.info | ||
| # fail_ci_if_error: false | ||
| # env: | ||
| # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
|
||
| # miri: | ||
| # needs: basics | ||
| # name: miri-test | ||
| # runs-on: ubuntu-latest | ||
| # steps: | ||
| # - uses: actions/checkout@v4 | ||
| # with: | ||
| # lfs: true | ||
|
|
||
| # - name: Install Rust nightly with miri | ||
| # uses: dtolnay/rust-toolchain@stable | ||
| # with: | ||
| # toolchain: nightly | ||
| # components: miri | ||
|
|
||
| # - name: Install cargo-nextest | ||
| # uses: taiki-e/install-action@v2 | ||
| # with: | ||
| # tool: cargo-nextest | ||
|
|
||
| # - uses: Swatinem/rust-cache@v2 | ||
| # - name: miri | ||
| # run: cargo +nightly miri nextest run --package diskann-quantization | ||
| # env: | ||
| # MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.