Skip to content

ci: resolve MSRV from Cargo.toml #82

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 2 commits into from
Mar 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ env:
CARGO_TERM_COLOR: always

jobs:
resolve:
runs-on: ubuntu-latest
outputs:
MSRV: ${{ steps.resolve-msrv.outputs.MSRV }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: resolve MSRV
id: resolve-msrv
run: echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT

fmt:
runs-on: ubuntu-latest
steps:
Expand All @@ -30,7 +43,7 @@ jobs:
- run: cargo clippy --all

build:
needs: [fmt] # don't wait for clippy as fails rarely and takes longer
needs: [resolve, fmt] # don't wait for clippy as fails rarely and takes longer
name: python${{ matrix.python-version }} ${{ matrix.os }} rust-${{ matrix.rust}}
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -43,7 +56,7 @@ jobs:
include:
- python-version: "3.13"
os: "ubuntu-latest"
rust: "1.63"
rust: ${{ needs.resolve.outputs.MSRV }}
- python-version: "3.13"
python-architecture: "arm64"
os: "macos-latest"
Expand All @@ -66,6 +79,12 @@ jobs:
- uses: Swatinem/rust-cache@v2
continue-on-error: true

- if: ${{ matrix.rust == needs.resolve.outputs.MSRV }}
name: Set dependencies on MSRV
run: cargo +stable update
env:
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback

- name: Test
run: cargo test --verbose

Expand Down
Loading