Skip to content

Commit 7626797

Browse files
authored
chore: Non-breaking portgraph & pyo3 version bump (#2069)
`portgraph` is about to [make a breaking release](CQCL/portgraph#194), and `pyo3` recently did so. Normally bumping the dependencies would require us to make a breaking release of `hugr`, but since in both cases there are no code changes required for the update we can do a loose version requirement instead, and let downstream dependents update both dependencies at their own pace. drive-by: Setup the MSRV CI check to use the minimal dependency versions, to ensure we don't break things in the future. This has de added benefit that we no longer need to pin dependencies in `Cargo.lock` if their newer versions bumped their MSRV (it currently happens with `half` and `zerofrom`)
1 parent 2968bc5 commit 7626797

File tree

3 files changed

+115
-45
lines changed

3 files changed

+115
-45
lines changed

.github/workflows/ci-rs.yml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ jobs:
190190
matrix:
191191
# Stable is covered by `tests-stable-no-features` and `tests-stable-all-features`
192192
# Nightly is covered by `tests-nightly-coverage`
193-
rust: ["1.75", beta]
193+
# MSRV is covered by `tests-msrv`
194+
rust: [beta]
194195
name: tests (Rust ${{ matrix.rust }})
195196
steps:
196197
- uses: actions/checkout@v4
@@ -220,6 +221,59 @@ jobs:
220221
if: ${{ needs.changes.outputs.llvm == 'true'}}
221222
run: cargo test -p hugr-llvm --verbose --features llvm${{ env.LLVM_FEATURE_NAME }}
222223

224+
# Run tests on the minimum supported rust version, with minimal dependency versions
225+
tests-msrv:
226+
needs: changes
227+
if: ${{ needs.changes.outputs.rust == 'true' && github.event_name != 'merge_group' }}
228+
runs-on: ubuntu-latest
229+
name: tests (Rust MSRV, min dependencies)
230+
steps:
231+
- uses: actions/checkout@v4
232+
- uses: mozilla-actions/sccache-action@v0.0.9
233+
- name: Install MSRV toolchain
234+
id: toolchain
235+
uses: dtolnay/rust-toolchain@master
236+
with:
237+
toolchain: "1.75"
238+
- name: Install nightly toolchain
239+
uses: dtolnay/rust-toolchain@master
240+
with:
241+
# Nightly must be installed for `cargo-minimal-versions` to work
242+
toolchain: "nightly"
243+
- name: Configure default rust toolchain
244+
run: rustup override set ${{steps.toolchain.outputs.name}}
245+
- name: Install LLVM and Clang
246+
uses: KyleMayes/install-llvm-action@v2
247+
with:
248+
version: ${{ env.LLVM_VERSION }}
249+
- uses: cargo-bins/cargo-binstall@main
250+
- name: Install cargo-minimal-versions
251+
run: |
252+
cargo binstall cargo-hack --force
253+
cargo binstall cargo-minimal-versions --force
254+
- name: Pin transitive dependencies not compatible with our MSRV
255+
# Add new dependencies as needed if the check fails due to
256+
# "package `XXX` cannot be built because it requires rustc YYY or newer, while the currently active rustc version is 1.75.0"
257+
run: |
258+
rm Cargo.lock
259+
cargo add -p hugr half@2.4.1
260+
cargo add -p hugr litemap@0.7.4
261+
cargo add -p hugr zerofrom@0.1.5
262+
- name: Build with no features
263+
run: cargo minimal-versions --direct test --verbose --no-default-features --no-run
264+
- name: Tests with no features
265+
run: cargo minimal-versions --direct test --verbose --no-default-features
266+
- name: Build with all features
267+
run: cargo minimal-versions --direct test --verbose --all-features --no-run
268+
- name: Tests with all features
269+
run: cargo minimal-versions --direct test --verbose --all-features
270+
- name: Build hugr-llvm
271+
if: ${{ needs.changes.outputs.llvm == 'true'}}
272+
run: cargo minimal-versions --direct test -p hugr-llvm --verbose --features llvm${{ env.LLVM_FEATURE_NAME }} --no-run
273+
- name: Tests hugr-llvm
274+
if: ${{ needs.changes.outputs.llvm == 'true'}}
275+
run: cargo minimal-versions --direct test -p hugr-llvm --verbose --features llvm${{ env.LLVM_FEATURE_NAME }}
276+
223277
# Ensure that serialized extensions match rust implementation
224278
std-extensions:
225279
needs: [changes, tests-stable-all-features]

Cargo.lock

Lines changed: 51 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ missing_docs = "warn"
3737
debug_assert_with_mut_call = "warn"
3838

3939
[workspace.dependencies]
40-
portgraph = { version = "0.13.3" }
4140
insta = { version = "1.42.2" }
4241
bitvec = "1.0.1"
4342
capnp = "0.20.6"
@@ -53,16 +52,15 @@ jsonschema = "0.29.1"
5352
lazy_static = "1.4.0"
5453
num-rational = "0.4.1"
5554
paste = "1.0"
56-
petgraph = { version = "0.7.1", default-features = false }
5755
proptest = "1.4.0"
5856
proptest-derive = "0.5.0"
59-
regex = "1.9.5"
57+
regex = "1.10.6"
6058
regex-syntax = "0.8.3"
6159
rstest = "0.24.0"
6260
semver = "1.0.26"
63-
serde = "1.0"
61+
serde = "1.0.195"
6462
serde_json = "1.0.140"
65-
serde_yaml = "0.9.19"
63+
serde_yaml = "0.9.34"
6664
smol_str = "0.3.1"
6765
static_assertions = "1.1.0"
6866
strum = "0.27.0"
@@ -85,7 +83,12 @@ pest_derive = "2.8.0"
8583
pretty = "0.12.4"
8684
pretty_assertions = "1.4.1"
8785
zstd = "0.13.2"
88-
pyo3 = "0.23.4"
86+
87+
# These public dependencies usually require breaking changes downstream, so we
88+
# try to be as permissive as possible.
89+
pyo3 = ">= 0.23.4, < 0.25"
90+
portgraph = { version = ">= 0.13.3, < 0.15" }
91+
petgraph = { version = ">= 0.7.1, < 0.9", default-features = false }
8992

9093
[profile.dev.package]
9194
insta.opt-level = 3

0 commit comments

Comments
 (0)