-
Notifications
You must be signed in to change notification settings - Fork 792
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/upstream/main' into stub-g…
…eneration-static # Conflicts: # pyo3-macros-backend/Cargo.toml # pyo3-macros-backend/src/pyclass.rs # pyo3-macros/Cargo.toml # pytests/src/lib.rs
- Loading branch information
Showing
320 changed files
with
7,625 additions
and
11,825 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,18 @@ jobs: | |
- name: Check rust formatting (rustfmt) | ||
run: nox -s rustfmt | ||
|
||
resolve: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
MSRV: ${{ steps.resolve-msrv.outputs.MSRV }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- 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 | ||
|
||
semver-checks: | ||
if: github.ref != 'refs/heads/main' | ||
needs: [fmt] | ||
|
@@ -41,13 +53,13 @@ jobs: | |
- uses: obi1kenobi/cargo-semver-checks-action@v2 | ||
|
||
check-msrv: | ||
needs: [fmt] | ||
needs: [fmt, resolve] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: 1.63.0 | ||
toolchain: ${{ needs.resolve.outputs.MSRV }} | ||
targets: x86_64-unknown-linux-gnu | ||
components: rust-src | ||
- uses: actions/setup-python@v5 | ||
|
@@ -57,9 +69,11 @@ jobs: | |
with: | ||
save-if: ${{ github.event_name != 'merge_group' }} | ||
- run: python -m pip install --upgrade pip && pip install nox | ||
- name: Prepare minimal package versions | ||
run: nox -s set-minimal-package-versions | ||
- run: nox -s check-all | ||
# This is a smoke test to confirm that CI will run on MSRV (including dev dependencies) | ||
- name: Check with MSRV package versions | ||
run: | | ||
nox -s set-msrv-package-versions | ||
nox -s check-all | ||
env: | ||
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu | ||
|
@@ -141,14 +155,15 @@ jobs: | |
build-pr: | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-build-full') && github.event_name == 'pull_request' }} | ||
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} rust-${{ matrix.rust }} | ||
needs: [fmt] | ||
needs: [fmt, resolve] | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
os: ${{ matrix.platform.os }} | ||
python-version: ${{ matrix.python-version }} | ||
python-architecture: ${{ matrix.platform.python-architecture }} | ||
rust: ${{ matrix.rust }} | ||
rust-target: ${{ matrix.platform.rust-target }} | ||
MSRV: ${{ needs.resolve.outputs.MSRV }} | ||
secrets: inherit | ||
strategy: | ||
# If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present | ||
|
@@ -198,14 +213,15 @@ jobs: | |
build-full: | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }} | ||
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} rust-${{ matrix.rust }} | ||
needs: [fmt] | ||
needs: [fmt, resolve] | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
os: ${{ matrix.platform.os }} | ||
python-version: ${{ matrix.python-version }} | ||
python-architecture: ${{ matrix.platform.python-architecture }} | ||
rust: ${{ matrix.rust }} | ||
rust-target: ${{ matrix.platform.rust-target }} | ||
MSRV: ${{ needs.resolve.outputs.MSRV }} | ||
secrets: inherit | ||
strategy: | ||
# If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present | ||
|
@@ -251,7 +267,7 @@ jobs: | |
] | ||
include: | ||
# Test minimal supported Rust version | ||
- rust: 1.63.0 | ||
- rust: ${{ needs.resolve.outputs.MSRV }} | ||
python-version: "3.12" | ||
platform: | ||
{ | ||
|
@@ -473,6 +489,35 @@ jobs: | |
echo PYO3_CONFIG_FILE=$PYO3_CONFIG_FILE >> $GITHUB_ENV | ||
- run: python3 -m nox -s test | ||
|
||
test-free-threaded: | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }} | ||
needs: [fmt] | ||
runs-on: ubuntu-latest | ||
env: | ||
UNSAFE_PYO3_BUILD_FREE_THREADED: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
save-if: ${{ github.event_name != 'merge_group' }} | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rust-src | ||
# TODO: replace with setup-python when there is support | ||
- uses: deadsnakes/[email protected] | ||
with: | ||
python-version: '3.13-dev' | ||
nogil: true | ||
- run: python3 -m sysconfig | ||
- run: python3 -m pip install --upgrade pip && pip install nox | ||
- run: nox -s ffi-check | ||
- name: Run default nox sessions that should pass | ||
run: nox -s clippy docs rustfmt ruff | ||
- name: Run PyO3 tests with free-threaded Python (can fail) | ||
# TODO fix the test crashes so we can unset this | ||
continue-on-error: true | ||
run: nox -s test | ||
|
||
test-version-limits: | ||
needs: [fmt] | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }} | ||
|
@@ -487,21 +532,31 @@ jobs: | |
- run: python3 -m nox -s test-version-limits | ||
|
||
check-feature-powerset: | ||
needs: [fmt] | ||
needs: [fmt, resolve] | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }} | ||
runs-on: ubuntu-latest | ||
name: check-feature-powerset ${{ matrix.rust }} | ||
strategy: | ||
# run on stable and MSRV to check that all combinations of features are expected to build fine on our supported | ||
# range of compilers | ||
matrix: | ||
rust: ["stable"] | ||
include: | ||
- rust: ${{ needs.resolve.outputs.MSRV }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
save-if: ${{ github.event_name != 'merge_group' }} | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
components: rust-src | ||
- uses: taiki-e/install-action@cargo-hack | ||
toolchain: stable | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-hack,cargo-minimal-versions | ||
- run: python3 -m pip install --upgrade pip && pip install nox | ||
- run: python3 -m nox -s check-feature-powerset | ||
- run: python3 -m nox -s check-feature-powerset -- ${{ matrix.rust != 'stable' && 'minimal-versions' || '' }} | ||
|
||
test-cross-compilation: | ||
needs: [fmt] | ||
|
@@ -644,6 +699,7 @@ jobs: | |
- coverage | ||
- emscripten | ||
- test-debug | ||
- test-free-threaded | ||
- test-version-limits | ||
- check-feature-powerset | ||
- test-cross-compilation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.