Skip to content

Commit b50f1c3

Browse files
committed
ci: check minimal-versions on MSRV feature powerset (#4273)
* ci: check minimal-versions on MSRV feature powerset * fix msrv arg * bump num-bigint floor to 0.4.2 * try fix build syntax
1 parent d9ee5f7 commit b50f1c3

File tree

4 files changed

+56
-23
lines changed

4 files changed

+56
-23
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
rust-target:
1717
required: true
1818
type: string
19+
MSRV:
20+
required: true
21+
type: string
1922

2023
jobs:
2124
build:
@@ -51,9 +54,9 @@ jobs:
5154
name: Prepare LD_LIBRARY_PATH (Ubuntu only)
5255
run: echo LD_LIBRARY_PATH=${pythonLocation}/lib >> $GITHUB_ENV
5356

54-
- if: inputs.rust == '1.63.0'
55-
name: Prepare minimal package versions (MSRV only)
56-
run: nox -s set-minimal-package-versions
57+
- if: inputs.rust == inputs.MSRV
58+
name: Prepare MSRV package versions
59+
run: nox -s set-msrv-package-versions
5760

5861
- if: inputs.rust != 'stable'
5962
name: Ignore changed error messages when using trybuild

.github/workflows/ci.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ jobs:
3131
- name: Check rust formatting (rustfmt)
3232
run: nox -s rustfmt
3333

34+
resolve:
35+
runs-on: ubuntu-latest
36+
outputs:
37+
MSRV: ${{ steps.resolve-msrv.outputs.MSRV }}
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: actions/setup-python@v5
41+
- name: resolve MSRV
42+
id: resolve-msrv
43+
run:
44+
echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT
45+
3446
semver-checks:
3547
if: github.ref != 'refs/heads/main'
3648
needs: [fmt]
@@ -41,13 +53,13 @@ jobs:
4153
- uses: obi1kenobi/cargo-semver-checks-action@v2
4254

4355
check-msrv:
44-
needs: [fmt]
56+
needs: [fmt, resolve]
4557
runs-on: ubuntu-latest
4658
steps:
4759
- uses: actions/checkout@v4
4860
- uses: dtolnay/rust-toolchain@master
4961
with:
50-
toolchain: 1.63.0
62+
toolchain: ${{ needs.resolve.outputs.MSRV }}
5163
targets: x86_64-unknown-linux-gnu
5264
components: rust-src
5365
- uses: actions/setup-python@v5
@@ -57,9 +69,11 @@ jobs:
5769
with:
5870
save-if: ${{ github.event_name != 'merge_group' }}
5971
- run: python -m pip install --upgrade pip && pip install nox
60-
- name: Prepare minimal package versions
61-
run: nox -s set-minimal-package-versions
62-
- run: nox -s check-all
72+
# This is a smoke test to confirm that CI will run on MSRV (including dev dependencies)
73+
- name: Check with MSRV package versions
74+
run: |
75+
nox -s set-msrv-package-versions
76+
nox -s check-all
6377
6478
env:
6579
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
@@ -141,14 +155,15 @@ jobs:
141155
build-pr:
142156
if: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-build-full') && github.event_name == 'pull_request' }}
143157
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} rust-${{ matrix.rust }}
144-
needs: [fmt]
158+
needs: [fmt, resolve]
145159
uses: ./.github/workflows/build.yml
146160
with:
147161
os: ${{ matrix.platform.os }}
148162
python-version: ${{ matrix.python-version }}
149163
python-architecture: ${{ matrix.platform.python-architecture }}
150164
rust: ${{ matrix.rust }}
151165
rust-target: ${{ matrix.platform.rust-target }}
166+
MSRV: ${{ needs.resolve.outputs.MSRV }}
152167
secrets: inherit
153168
strategy:
154169
# If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present
@@ -198,14 +213,15 @@ jobs:
198213
build-full:
199214
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
200215
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} rust-${{ matrix.rust }}
201-
needs: [fmt]
216+
needs: [fmt, resolve]
202217
uses: ./.github/workflows/build.yml
203218
with:
204219
os: ${{ matrix.platform.os }}
205220
python-version: ${{ matrix.python-version }}
206221
python-architecture: ${{ matrix.platform.python-architecture }}
207222
rust: ${{ matrix.rust }}
208223
rust-target: ${{ matrix.platform.rust-target }}
224+
MSRV: ${{ needs.resolve.outputs.MSRV }}
209225
secrets: inherit
210226
strategy:
211227
# If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present
@@ -251,7 +267,7 @@ jobs:
251267
]
252268
include:
253269
# Test minimal supported Rust version
254-
- rust: 1.63.0
270+
- rust: ${{ needs.resolve.outputs.MSRV }}
255271
python-version: "3.12"
256272
platform:
257273
{
@@ -487,21 +503,31 @@ jobs:
487503
- run: python3 -m nox -s test-version-limits
488504

489505
check-feature-powerset:
490-
needs: [fmt]
506+
needs: [fmt, resolve]
491507
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
492508
runs-on: ubuntu-latest
509+
name: check-feature-powerset ${{ matrix.rust }}
510+
strategy:
511+
# run on stable and MSRV to check that all combinations of features are expected to build fine on our supported
512+
# range of compilers
513+
matrix:
514+
rust: ["stable"]
515+
include:
516+
- rust: ${{ needs.resolve.outputs.MSRV }}
493517
steps:
494518
- uses: actions/checkout@v4
495519
- uses: actions/setup-python@v5
496520
- uses: Swatinem/rust-cache@v2
497521
with:
498522
save-if: ${{ github.event_name != 'merge_group' }}
499-
- uses: dtolnay/rust-toolchain@stable
523+
- uses: dtolnay/rust-toolchain@master
500524
with:
501-
components: rust-src
502-
- uses: taiki-e/install-action@cargo-hack
525+
toolchain: stable
526+
- uses: taiki-e/install-action@v2
527+
with:
528+
tool: cargo-hack,cargo-minimal-versions
503529
- run: python3 -m pip install --upgrade pip && pip install nox
504-
- run: python3 -m nox -s check-feature-powerset
530+
- run: python3 -m nox -s check-feature-powerset -- ${{ matrix.rust != 'stable' && 'minimal-versions' || '' }}
505531

506532
test-cross-compilation:
507533
needs: [fmt]

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rust-version = "1.63"
1818
cfg-if = "1.0"
1919
libc = "0.2.62"
2020
memoffset = "0.9"
21-
once_cell = "1.13.0"
21+
once_cell = "1.13"
2222

2323
# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
2424
pyo3-ffi = { path = "pyo3-ffi", version = "=0.22.1" }
@@ -32,17 +32,17 @@ unindent = { version = "0.2.1", optional = true }
3232
inventory = { version = "0.3.0", optional = true }
3333

3434
# crate integrations that can be added using the eponymous features
35-
anyhow = { version = "1.0", optional = true }
35+
anyhow = { version = "1.0.1", optional = true }
3636
chrono = { version = "0.4.25", default-features = false, optional = true }
3737
chrono-tz = { version = ">= 0.6, < 0.10", default-features = false, optional = true }
3838
either = { version = "1.9", optional = true }
3939
eyre = { version = ">= 0.4, < 0.7", optional = true }
4040
hashbrown = { version = ">= 0.9, < 0.15", optional = true }
4141
indexmap = { version = ">= 1.6, < 3", optional = true }
42-
num-bigint = { version = "0.4", optional = true }
42+
num-bigint = { version = "0.4.2", optional = true }
4343
num-complex = { version = ">= 0.2, < 0.5", optional = true }
4444
num-rational = {version = "0.4.1", optional = true }
45-
rust_decimal = { version = "1.0.0", default-features = false, optional = true }
45+
rust_decimal = { version = "1.15", default-features = false, optional = true }
4646
serde = { version = "1.0", optional = true }
4747
smallvec = { version = "1.0", optional = true }
4848

noxfile.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ def check_changelog(session: nox.Session):
543543
print(fragment.name)
544544

545545

546-
@nox.session(name="set-minimal-package-versions", venv_backend="none")
547-
def set_minimal_package_versions(session: nox.Session):
546+
@nox.session(name="set-msrv-package-versions", venv_backend="none")
547+
def set_msrv_package_versions(session: nox.Session):
548548
from collections import defaultdict
549549

550550
if toml is None:
@@ -708,10 +708,14 @@ def check_feature_powerset(session: nox.Session):
708708
rust_flags = env.get("RUSTFLAGS", "")
709709
env["RUSTFLAGS"] = f"{rust_flags} -Dwarnings"
710710

711+
subcommand = "hack"
712+
if "minimal-versions" in session.posargs:
713+
subcommand = "minimal-versions"
714+
711715
comma_join = ",".join
712716
_run_cargo(
713717
session,
714-
"hack",
718+
subcommand,
715719
"--feature-powerset",
716720
'--optional-deps=""',
717721
f'--skip="{comma_join(features_to_skip)}"',

0 commit comments

Comments
 (0)