-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
chore: check minimal versions on CI #596
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ env: | |
RUSTUP_MAX_RETRIES: 10 | ||
# Don't emit giant backtraces in the CI logs. | ||
RUST_BACKTRACE: short | ||
# Pin a nightly version for minimal versions | ||
rust_nightly: nightly-2024-05-05 | ||
|
||
jobs: | ||
check: | ||
|
@@ -42,6 +44,27 @@ jobs: | |
- name: Run cargo check | ||
run: cargo check | ||
|
||
minimal-versions: | ||
name: minimal-versions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust ${{ env.rust_nightly }} | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: ${{ env.rust_nightly }} | ||
- name: Install cargo-hack | ||
uses: taiki-e/install-action@cargo-hack | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: "check -Z direct-minimal-versions" | ||
run: | | ||
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update` | ||
# from determining minimal versions based on dev-dependencies. | ||
cargo hack --remove-dev-deps --workspace | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is for rust-lang/cargo#5657 (comment)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also just because we don't need to have exact versions for dev dependencies (since it doesn't affect crates that depend on us). |
||
# Update Cargo.lock to minimal version dependencies. | ||
cargo +${{ env.rust_nightly }} update -Z direct-minimal-versions | ||
cargo check | ||
|
||
test_os: | ||
name: Tests on ${{ matrix.os }} with Rust ${{ matrix.rust }} | ||
runs-on: ${{ matrix.os }} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask why we need to pin the nightly version here? Is it to avoid breaking changes from Cargo's resolver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nightly versions may not always work. So we're pinning this to avoid flaky tests depending on the most recent nightly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Thank you!