Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Use direct-minimal-versions as part of MSRV job
Browse files Browse the repository at this point in the history
This is to reliably test MSRV by ensuring that the lower-bounds for
dependencies are correct, rather than testing the MSRV Rust version and
minimal cargo dependency versions separately.

See:
- rust-lang/cargo#5657
  • Loading branch information
elasticdog committed May 16, 2023
1 parent 9ea7ce7 commit 88fb08f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 59 deletions.
19 changes: 14 additions & 5 deletions .github/cue/rust.cue
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ rust: _#useMergeQueue & {
}

// Minimum Supported Rust Version
check_msrv: {
name: "check / msrv"
test_msrv: {
name: "test / msrv"
needs: ["check", "format", "lint"]
"runs-on": defaultRunner
if: "always() && needs.changes.outputs.rust == 'true'"
Expand All @@ -93,16 +93,25 @@ rust: _#useMergeQueue & {
name: "Get MSRV from package metadata"
run: "awk -F '\"' '/rust-version/{ print \"version=\" $2 }' Cargo.toml >> $GITHUB_OUTPUT"
},
_#installRust & {with: toolchain: "${{ steps.msrv.outputs.version }}"},
_#installRust & {with: toolchain: "${{ steps.msrv.outputs.version }}"},
_#installRust & {with: toolchain: "nightly"},
{
name: "Resolve minimal dependency versions instead of maximum"
run: "cargo +nightly update -Z direct-minimal-versions"
},
{
name: "Default to MSRV Rust"
run: "rustup default ${{ steps.msrv.outputs.version }}"
},
_#cacheRust & {with: "shared-key": "msrv-\(defaultRunner)"},
_#cargoCheck,
for step in _testRust {step},
]
}

merge_queue: needs: [
"changes",
"test_stable",
"check_msrv",
"test_msrv",
]
}
}
19 changes: 0 additions & 19 deletions .github/cue/scheduled.cue
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,6 @@ scheduled: {
}

jobs: {
direct_minimal_versions: {
name: "direct-minimal-versions / stable"
"runs-on": defaultRunner
steps: [
_#checkoutCode,
_#installRust,
_#installRust & {with: toolchain: "nightly"},
{
name: "Default to stable Rust"
run: "rustup default stable"
},
{
name: "Resolve minimal dependency versions instead of maximum"
run: "cargo +nightly update -Z direct-minimal-versions"
},
for step in _testRust {step},
]
}

// https://github.com/rust-lang/miri
// Detect certain classes of undefined behavior.
miri: {
Expand Down
30 changes: 23 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ jobs:
run: cargo nextest run --locked --all-targets --all-features
- name: Run doctests
run: cargo test --locked --doc
check_msrv:
name: check / msrv
test_msrv:
name: test / msrv
needs:
- check
- format
Expand All @@ -169,19 +169,35 @@ jobs:
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: ${{ steps.msrv.outputs.version }}
- name: Install nightly Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: nightly
- name: Resolve minimal dependency versions instead of maximum
run: cargo +nightly update -Z direct-minimal-versions
- name: Default to MSRV Rust
run: rustup default ${{ steps.msrv.outputs.version }}
- name: Cache dependencies
uses: Swatinem/rust-cache@060bda31e0be4f453bb6ed2d7e5427b31734ad01
with:
shared-key: msrv-ubuntu-latest
timeout-minutes: 5
- name: Check packages and dependencies for errors
run: cargo check --locked --all-targets --all-features
- name: Install cargo-nextest
uses: taiki-e/install-action@97bdefc2d9c284a0a0e620f6d484dd156d256e81
with:
tool: cargo-nextest
- name: Compile tests
run: cargo test --locked --no-run
- name: Run tests
run: cargo nextest run --locked --all-targets --all-features
- name: Run doctests
run: cargo test --locked --doc
merge_queue:
name: rust workflow ready
needs:
- changes
- test_stable
- check_msrv
- test_msrv
runs-on: ubuntu-latest
if: always()
steps:
Expand All @@ -205,9 +221,9 @@ jobs:
echo "Error: The required job did not pass."
exit 1
fi
- name: 'Check status of job_id: check_msrv'
- name: 'Check status of job_id: test_msrv'
run: |-
RESULT="${{ needs.check_msrv.result }}";
RESULT="${{ needs.test_msrv.result }}";
if [[ $RESULT == "success" || $RESULT == "skipped" ]]; then
exit 0
else
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,6 @@ env:
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
jobs:
direct_minimal_versions:
name: direct-minimal-versions / stable
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: stable
- name: Install nightly Rust toolchain
uses: dtolnay/rust-toolchain@b44cb146d03e8d870c57ab64b80f04586349ca5d
with:
toolchain: nightly
- name: Default to stable Rust
run: rustup default stable
- name: Resolve minimal dependency versions instead of maximum
run: cargo +nightly update -Z direct-minimal-versions
- name: Install cargo-nextest
uses: taiki-e/install-action@97bdefc2d9c284a0a0e620f6d484dd156d256e81
with:
tool: cargo-nextest
- name: Compile tests
run: cargo test --locked --no-run
- name: Run tests
run: cargo nextest run --locked --all-targets --all-features
- name: Run doctests
run: cargo test --locked --doc
miri:
name: test / miri
runs-on: ubuntu-latest
Expand Down

0 comments on commit 88fb08f

Please sign in to comment.