2020-08-11 21:32:59 +00:00
|
|
|
name: CI
|
2019-11-16 12:39:59 +00:00
|
|
|
|
2020-08-16 13:36:15 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-03-16 22:14:57 +00:00
|
|
|
- main
|
2020-08-16 13:36:15 +00:00
|
|
|
pull_request:
|
2023-06-04 13:29:41 +00:00
|
|
|
merge_group:
|
|
|
|
types: [checks_requested]
|
2022-04-17 03:28:21 +00:00
|
|
|
workflow_dispatch:
|
2019-11-16 12:39:59 +00:00
|
|
|
|
2022-03-15 12:47:39 +00:00
|
|
|
concurrency:
|
2022-11-23 14:15:46 +00:00
|
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}
|
2022-03-15 12:47:39 +00:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-09-01 19:59:28 +00:00
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
2019-11-16 12:39:59 +00:00
|
|
|
jobs:
|
2020-08-08 17:03:16 +00:00
|
|
|
fmt:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-04 20:47:53 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-12-11 20:04:18 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2023-05-01 15:53:57 +00:00
|
|
|
- run: python -m pip install --upgrade pip && pip install nox
|
2022-11-02 01:39:34 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2020-08-08 17:03:16 +00:00
|
|
|
with:
|
2020-08-16 13:36:15 +00:00
|
|
|
components: rustfmt
|
2023-10-26 07:52:07 +00:00
|
|
|
- name: Check python formatting and lints (ruff)
|
|
|
|
run: nox -s ruff
|
2020-08-08 17:03:16 +00:00
|
|
|
- name: Check rust formatting (rustfmt)
|
2023-10-26 07:52:07 +00:00
|
|
|
run: nox -s rustfmt
|
2020-08-08 17:03:16 +00:00
|
|
|
|
2024-07-10 11:36:31 +00:00
|
|
|
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
|
|
|
|
|
2023-11-18 13:25:05 +00:00
|
|
|
semver-checks:
|
|
|
|
if: github.ref != 'refs/heads/main'
|
|
|
|
needs: [fmt]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2023-12-11 20:04:18 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2023-11-18 13:25:05 +00:00
|
|
|
- uses: obi1kenobi/cargo-semver-checks-action@v2
|
|
|
|
|
2023-06-04 21:58:44 +00:00
|
|
|
check-msrv:
|
2024-07-10 11:36:31 +00:00
|
|
|
needs: [fmt, resolve]
|
2023-06-04 21:58:44 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-04 20:47:53 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-04 21:58:44 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
2024-07-10 11:36:31 +00:00
|
|
|
toolchain: ${{ needs.resolve.outputs.MSRV }}
|
2023-06-04 21:58:44 +00:00
|
|
|
targets: x86_64-unknown-linux-gnu
|
2023-06-05 07:36:13 +00:00
|
|
|
components: rust-src
|
2023-12-11 20:04:18 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2023-06-04 21:58:44 +00:00
|
|
|
with:
|
|
|
|
architecture: "x64"
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
2024-02-23 00:51:50 +00:00
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2023-06-04 21:58:44 +00:00
|
|
|
- run: python -m pip install --upgrade pip && pip install nox
|
2024-07-10 11:36:31 +00:00
|
|
|
# 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
|
2023-06-04 21:58:44 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
|
|
|
|
|
2020-08-08 17:03:16 +00:00
|
|
|
clippy:
|
2021-08-30 08:13:43 +00:00
|
|
|
needs: [fmt]
|
2022-12-24 19:17:25 +00:00
|
|
|
runs-on: ${{ matrix.platform.os }}
|
2021-08-30 08:13:43 +00:00
|
|
|
strategy:
|
2022-03-15 15:46:02 +00:00
|
|
|
# If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present
|
|
|
|
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
|
2021-08-30 08:13:43 +00:00
|
|
|
matrix:
|
2022-12-24 19:17:25 +00:00
|
|
|
rust: [stable]
|
|
|
|
platform: [
|
|
|
|
{
|
2024-03-23 20:16:37 +00:00
|
|
|
os: "macos-14", # first available arm macos runner
|
|
|
|
python-architecture: "arm64",
|
|
|
|
rust-target: "aarch64-apple-darwin",
|
2022-12-24 19:17:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-unknown-linux-gnu",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "powerpc64le-unknown-linux-gnu",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "s390x-unknown-linux-gnu",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "wasm32-wasi",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "windows-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-pc-windows-msvc",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "windows-latest",
|
|
|
|
python-architecture: "x86",
|
|
|
|
rust-target: "i686-pc-windows-msvc",
|
|
|
|
},
|
|
|
|
]
|
2023-11-26 10:00:08 +00:00
|
|
|
include:
|
|
|
|
# Run beta clippy as a way to detect any incoming lints which may affect downstream users
|
|
|
|
- rust: beta
|
|
|
|
platform:
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-unknown-linux-gnu",
|
|
|
|
}
|
2022-12-24 19:17:25 +00:00
|
|
|
name: clippy/${{ matrix.platform.rust-target }}/${{ matrix.rust }}
|
2024-03-23 20:16:37 +00:00
|
|
|
continue-on-error: ${{ matrix.rust != 'stable' }}
|
2021-08-30 08:13:43 +00:00
|
|
|
steps:
|
2023-09-04 20:47:53 +00:00
|
|
|
- uses: actions/checkout@v4
|
2022-12-24 19:17:25 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
2021-08-30 08:13:43 +00:00
|
|
|
with:
|
2022-12-24 19:17:25 +00:00
|
|
|
toolchain: ${{ matrix.rust }}
|
2023-04-13 20:16:46 +00:00
|
|
|
targets: ${{ matrix.platform.rust-target }}
|
2023-05-09 07:37:24 +00:00
|
|
|
components: clippy,rust-src
|
2023-12-11 20:04:18 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2022-12-24 19:17:25 +00:00
|
|
|
with:
|
|
|
|
architecture: ${{ matrix.platform.python-architecture }}
|
2023-05-09 20:05:57 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
2024-02-23 00:51:50 +00:00
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2023-05-01 15:53:57 +00:00
|
|
|
- run: python -m pip install --upgrade pip && pip install nox
|
2022-12-24 19:17:25 +00:00
|
|
|
- run: nox -s clippy-all
|
2023-04-13 20:16:46 +00:00
|
|
|
env:
|
|
|
|
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}
|
2021-08-30 08:13:43 +00:00
|
|
|
|
2022-11-21 02:52:31 +00:00
|
|
|
build-pr:
|
2023-06-07 21:22:32 +00:00
|
|
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-build-full') && github.event_name == 'pull_request' }}
|
2022-11-21 02:52:31 +00:00
|
|
|
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} rust-${{ matrix.rust }}
|
2024-07-10 11:36:31 +00:00
|
|
|
needs: [fmt, resolve]
|
2022-11-21 02:52:31 +00:00
|
|
|
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 }}
|
2024-07-10 11:36:31 +00:00
|
|
|
MSRV: ${{ needs.resolve.outputs.MSRV }}
|
2022-11-21 02:52:31 +00:00
|
|
|
secrets: inherit
|
|
|
|
strategy:
|
|
|
|
# If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present
|
|
|
|
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
|
|
|
|
matrix:
|
|
|
|
rust: [stable]
|
2023-10-02 20:12:33 +00:00
|
|
|
python-version: ["3.12"]
|
2022-11-21 02:52:31 +00:00
|
|
|
platform:
|
|
|
|
[
|
|
|
|
{
|
2024-03-23 20:16:37 +00:00
|
|
|
os: "macos-14", # first available arm macos runner
|
|
|
|
python-architecture: "arm64",
|
|
|
|
rust-target: "aarch64-apple-darwin",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "macos-13", # last available x86_64 macos runner
|
2022-11-21 02:52:31 +00:00
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-apple-darwin",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-unknown-linux-gnu",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "windows-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-pc-windows-msvc",
|
|
|
|
},
|
2022-12-24 19:17:25 +00:00
|
|
|
{
|
|
|
|
os: "windows-latest",
|
|
|
|
python-architecture: "x86",
|
|
|
|
rust-target: "i686-pc-windows-msvc",
|
2023-10-25 06:44:19 +00:00
|
|
|
},
|
2022-11-21 02:52:31 +00:00
|
|
|
]
|
2023-10-25 06:44:19 +00:00
|
|
|
include:
|
|
|
|
# Test nightly Rust on PRs so that PR authors have a chance to fix nightly
|
|
|
|
# failures, as nightly does not block merge.
|
|
|
|
- rust: nightly
|
|
|
|
python-version: "3.12"
|
|
|
|
platform:
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-unknown-linux-gnu",
|
|
|
|
}
|
2022-11-21 02:52:31 +00:00
|
|
|
build-full:
|
2024-02-23 00:51:50 +00:00
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
2022-02-14 21:47:39 +00:00
|
|
|
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} rust-${{ matrix.rust }}
|
2024-07-10 11:36:31 +00:00
|
|
|
needs: [fmt, resolve]
|
2022-11-21 02:52:31 +00:00
|
|
|
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 }}
|
2024-07-10 11:36:31 +00:00
|
|
|
MSRV: ${{ needs.resolve.outputs.MSRV }}
|
2022-11-21 02:52:31 +00:00
|
|
|
secrets: inherit
|
2019-11-16 12:39:59 +00:00
|
|
|
strategy:
|
2022-03-15 15:46:02 +00:00
|
|
|
# If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present
|
|
|
|
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
|
2019-11-16 12:39:59 +00:00
|
|
|
matrix:
|
2020-08-16 13:36:15 +00:00
|
|
|
rust: [stable]
|
2022-02-05 00:22:09 +00:00
|
|
|
python-version: [
|
|
|
|
"3.7",
|
|
|
|
"3.8",
|
|
|
|
"3.9",
|
|
|
|
"3.10",
|
2023-02-27 22:25:07 +00:00
|
|
|
"3.11",
|
2023-10-02 19:57:41 +00:00
|
|
|
"3.12",
|
2024-05-25 22:41:26 +00:00
|
|
|
"3.13-dev",
|
2023-06-07 07:22:11 +00:00
|
|
|
"pypy3.7",
|
|
|
|
"pypy3.8",
|
|
|
|
"pypy3.9",
|
2023-07-03 10:26:45 +00:00
|
|
|
"pypy3.10",
|
2024-03-25 18:54:52 +00:00
|
|
|
"graalpy24.0",
|
2022-02-05 00:22:09 +00:00
|
|
|
]
|
2021-06-26 13:37:55 +00:00
|
|
|
platform:
|
|
|
|
[
|
2024-03-23 20:16:37 +00:00
|
|
|
# for the full matrix, use x86_64 macos runners because not all Python versions
|
|
|
|
# PyO3 supports are available for arm on GitHub Actions. (Availability starts
|
|
|
|
# around Python 3.10, can switch the full matrix to arm once earlier versions
|
|
|
|
# are dropped.)
|
|
|
|
# NB: if this switches to arm, switch the arm job below in the `include` to x86_64
|
2021-06-26 13:37:55 +00:00
|
|
|
{
|
2024-03-23 20:16:37 +00:00
|
|
|
os: "macos-13",
|
2021-06-26 13:37:55 +00:00
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-apple-darwin",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-unknown-linux-gnu",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
os: "windows-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-pc-windows-msvc",
|
|
|
|
},
|
|
|
|
]
|
2020-08-16 13:36:15 +00:00
|
|
|
include:
|
|
|
|
# Test minimal supported Rust version
|
2024-07-10 11:36:31 +00:00
|
|
|
- rust: ${{ needs.resolve.outputs.MSRV }}
|
2023-10-02 20:12:33 +00:00
|
|
|
python-version: "3.12"
|
2021-06-26 13:37:55 +00:00
|
|
|
platform:
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-unknown-linux-gnu",
|
|
|
|
}
|
2020-08-07 00:50:11 +00:00
|
|
|
|
2022-02-14 20:31:59 +00:00
|
|
|
# Test the `nightly` feature
|
|
|
|
- rust: nightly
|
2023-10-02 20:12:33 +00:00
|
|
|
python-version: "3.12"
|
2022-02-14 20:31:59 +00:00
|
|
|
platform:
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-unknown-linux-gnu",
|
|
|
|
}
|
2022-03-15 15:00:43 +00:00
|
|
|
|
2023-10-18 21:16:03 +00:00
|
|
|
# Run rust beta to help catch toolchain regressions
|
|
|
|
- rust: beta
|
|
|
|
python-version: "3.12"
|
|
|
|
platform:
|
|
|
|
{
|
|
|
|
os: "ubuntu-latest",
|
|
|
|
python-architecture: "x64",
|
|
|
|
rust-target: "x86_64-unknown-linux-gnu",
|
|
|
|
}
|
|
|
|
|
2022-03-15 15:00:43 +00:00
|
|
|
# Test 32-bit Windows only with the latest Python version
|
|
|
|
- rust: stable
|
2023-10-02 20:12:33 +00:00
|
|
|
python-version: "3.12"
|
2022-03-15 15:00:43 +00:00
|
|
|
platform:
|
|
|
|
{
|
|
|
|
os: "windows-latest",
|
|
|
|
python-architecture: "x86",
|
|
|
|
rust-target: "i686-pc-windows-msvc",
|
|
|
|
}
|
2022-12-14 21:30:55 +00:00
|
|
|
|
2024-03-23 20:16:37 +00:00
|
|
|
# test arm macos runner with the latest Python version
|
|
|
|
# NB: if the full matrix switchess to arm, switch to x86_64 here
|
|
|
|
- rust: stable
|
|
|
|
python-version: "3.12"
|
|
|
|
platform:
|
|
|
|
{
|
|
|
|
os: "macos-14",
|
|
|
|
python-architecture: "arm64",
|
|
|
|
rust-target: "aarch64-apple-darwin",
|
|
|
|
}
|
|
|
|
|
2022-10-28 20:04:11 +00:00
|
|
|
valgrind:
|
2024-02-23 00:51:50 +00:00
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
2022-10-28 20:04:11 +00:00
|
|
|
needs: [fmt]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-04 20:47:53 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-12-11 20:04:18 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2022-11-02 01:42:55 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2022-10-28 20:04:11 +00:00
|
|
|
with:
|
2024-02-23 00:51:50 +00:00
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2023-03-06 22:34:13 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2022-10-28 20:04:11 +00:00
|
|
|
- uses: taiki-e/install-action@valgrind
|
2023-05-01 15:53:57 +00:00
|
|
|
- run: python -m pip install --upgrade pip && pip install nox
|
2022-10-28 20:04:11 +00:00
|
|
|
- run: nox -s test-rust -- release skip-full
|
|
|
|
env:
|
|
|
|
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: valgrind --leak-check=no --error-exitcode=1
|
|
|
|
RUST_BACKTRACE: 1
|
|
|
|
TRYBUILD: overwrite
|
|
|
|
|
|
|
|
careful:
|
2024-02-23 00:51:50 +00:00
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
2022-10-28 20:04:11 +00:00
|
|
|
needs: [fmt]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-04 20:47:53 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-12-11 20:04:18 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2022-11-02 01:42:55 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2022-10-28 20:04:11 +00:00
|
|
|
with:
|
2024-02-23 00:51:50 +00:00
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2022-11-02 01:39:34 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
2022-10-28 20:04:11 +00:00
|
|
|
with:
|
|
|
|
components: rust-src
|
2023-10-16 19:16:01 +00:00
|
|
|
- uses: taiki-e/install-action@cargo-careful
|
2023-05-01 15:53:57 +00:00
|
|
|
- run: python -m pip install --upgrade pip && pip install nox
|
2022-10-28 20:04:11 +00:00
|
|
|
- run: nox -s test-rust -- careful skip-full
|
|
|
|
env:
|
|
|
|
RUST_BACKTRACE: 1
|
|
|
|
TRYBUILD: overwrite
|
|
|
|
|
2024-01-02 09:03:11 +00:00
|
|
|
docsrs:
|
2024-02-23 00:51:50 +00:00
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
2024-01-02 09:03:11 +00:00
|
|
|
needs: [fmt]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-01-08 20:14:38 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2024-01-02 09:03:11 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
2024-02-23 00:51:50 +00:00
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2024-01-02 09:03:11 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
|
|
with:
|
|
|
|
components: rust-src
|
2024-01-02 17:55:13 +00:00
|
|
|
- run: cargo rustdoc --lib --no-default-features --features full -Zunstable-options --config "build.rustdocflags=[\"--cfg\", \"docsrs\"]"
|
2024-01-02 09:03:11 +00:00
|
|
|
|
2020-08-11 21:32:59 +00:00
|
|
|
coverage:
|
|
|
|
needs: [fmt]
|
2024-03-23 20:16:37 +00:00
|
|
|
name: coverage ${{ matrix.os }}
|
2021-11-10 08:05:30 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-03-23 20:16:37 +00:00
|
|
|
os: ["windows-latest", "macos-14", "ubuntu-latest"] # first available arm macos runner
|
|
|
|
runs-on: ${{ matrix.os }}
|
2020-08-11 21:32:59 +00:00
|
|
|
steps:
|
2024-03-23 20:16:37 +00:00
|
|
|
- if: ${{ github.event_name == 'pull_request' && matrix.os != 'ubuntu-latest' }}
|
2022-11-21 02:52:31 +00:00
|
|
|
id: should-skip
|
|
|
|
shell: bash
|
|
|
|
run: echo 'skip=true' >> $GITHUB_OUTPUT
|
2023-09-04 20:47:53 +00:00
|
|
|
- uses: actions/checkout@v4
|
2022-11-21 02:52:31 +00:00
|
|
|
if: steps.should-skip.outputs.skip != 'true'
|
2023-12-11 20:04:18 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2022-11-21 02:52:31 +00:00
|
|
|
if: steps.should-skip.outputs.skip != 'true'
|
2022-11-02 01:42:55 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2022-11-21 02:52:31 +00:00
|
|
|
if: steps.should-skip.outputs.skip != 'true'
|
2021-04-04 07:49:27 +00:00
|
|
|
with:
|
2024-02-23 00:51:50 +00:00
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2022-11-02 01:39:34 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2022-11-21 02:52:31 +00:00
|
|
|
if: steps.should-skip.outputs.skip != 'true'
|
2021-11-10 08:05:30 +00:00
|
|
|
with:
|
2023-11-14 19:09:45 +00:00
|
|
|
components: llvm-tools-preview,rust-src
|
2022-01-24 22:58:36 +00:00
|
|
|
- name: Install cargo-llvm-cov
|
2022-11-21 02:52:31 +00:00
|
|
|
if: steps.should-skip.outputs.skip != 'true'
|
2022-01-24 22:58:36 +00:00
|
|
|
uses: taiki-e/install-action@cargo-llvm-cov
|
2023-05-01 15:53:57 +00:00
|
|
|
- run: python -m pip install --upgrade pip && pip install nox
|
2022-11-21 02:52:31 +00:00
|
|
|
if: steps.should-skip.outputs.skip != 'true'
|
2022-09-22 09:12:59 +00:00
|
|
|
- run: nox -s coverage
|
2022-11-21 02:52:31 +00:00
|
|
|
if: steps.should-skip.outputs.skip != 'true'
|
2024-02-05 18:43:19 +00:00
|
|
|
- uses: codecov/codecov-action@v4
|
2022-11-21 02:52:31 +00:00
|
|
|
if: steps.should-skip.outputs.skip != 'true'
|
2020-08-11 21:32:59 +00:00
|
|
|
with:
|
2023-04-12 06:35:16 +00:00
|
|
|
file: coverage.json
|
2021-11-10 08:05:30 +00:00
|
|
|
name: ${{ matrix.os }}
|
2024-02-05 18:50:18 +00:00
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2022-06-08 04:59:18 +00:00
|
|
|
|
|
|
|
emscripten:
|
|
|
|
name: emscripten
|
2024-02-23 00:51:50 +00:00
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
2024-02-23 08:16:37 +00:00
|
|
|
needs: [fmt]
|
2022-06-08 04:59:18 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-04 20:47:53 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-12-11 20:04:18 +00:00
|
|
|
- uses: actions/setup-python@v5
|
2023-10-13 06:25:36 +00:00
|
|
|
with:
|
|
|
|
# TODO bump emscripten builds to test on 3.12
|
|
|
|
python-version: 3.11
|
2022-06-08 07:09:42 +00:00
|
|
|
id: setup-python
|
2022-06-08 04:59:18 +00:00
|
|
|
- name: Install Rust toolchain
|
2022-11-02 01:39:34 +00:00
|
|
|
uses: dtolnay/rust-toolchain@stable
|
2022-06-08 04:59:18 +00:00
|
|
|
with:
|
2022-11-02 01:39:34 +00:00
|
|
|
targets: wasm32-unknown-emscripten
|
2023-11-14 19:09:45 +00:00
|
|
|
components: rust-src
|
2023-10-23 20:32:21 +00:00
|
|
|
- uses: actions/setup-node@v4
|
2022-06-08 04:59:18 +00:00
|
|
|
with:
|
|
|
|
node-version: 14
|
2023-05-01 15:53:57 +00:00
|
|
|
- run: python -m pip install --upgrade pip && pip install nox
|
2024-01-22 20:07:15 +00:00
|
|
|
- uses: actions/cache@v4
|
2022-06-08 04:59:18 +00:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.nox/emscripten
|
2022-06-08 07:09:42 +00:00
|
|
|
key: ${{ hashFiles('emscripten/*') }} - ${{ hashFiles('noxfile.py') }} - ${{ steps.setup-python.outputs.python-path }}
|
2022-11-02 01:42:55 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2022-06-08 04:59:18 +00:00
|
|
|
with:
|
2024-02-23 00:51:50 +00:00
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2022-06-08 04:59:18 +00:00
|
|
|
- name: Build
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2022-06-08 07:09:42 +00:00
|
|
|
run: nox -s build-emscripten
|
2022-06-08 04:59:18 +00:00
|
|
|
- name: Test
|
2022-06-08 07:09:42 +00:00
|
|
|
run: nox -s test-emscripten
|
2022-12-14 21:30:55 +00:00
|
|
|
|
2023-09-04 18:46:29 +00:00
|
|
|
test-debug:
|
2024-03-30 23:26:34 +00:00
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
2024-01-02 09:03:11 +00:00
|
|
|
needs: [fmt]
|
2023-09-04 18:46:29 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-11 20:30:05 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-09-04 18:46:29 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
2024-02-23 00:51:50 +00:00
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2023-09-04 18:46:29 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
components: rust-src
|
|
|
|
- name: Install python3 standalone debug build with nox
|
|
|
|
run: |
|
2023-10-04 18:43:23 +00:00
|
|
|
PBS_RELEASE="20231002"
|
|
|
|
PBS_PYTHON_VERSION="3.12.0"
|
2023-09-08 14:24:07 +00:00
|
|
|
PBS_ARCHIVE="cpython-${PBS_PYTHON_VERSION}+${PBS_RELEASE}-x86_64-unknown-linux-gnu-debug-full.tar.zst"
|
|
|
|
wget "https://github.com/indygreg/python-build-standalone/releases/download/${PBS_RELEASE}/${PBS_ARCHIVE}"
|
|
|
|
tar -I zstd -xf "${PBS_ARCHIVE}"
|
2023-09-04 18:46:29 +00:00
|
|
|
ls -l $(pwd)/python/install/bin
|
|
|
|
ls -l $(pwd)/python/install/lib
|
|
|
|
echo PATH=$(pwd)/python/install/bin:$PATH >> $GITHUB_ENV
|
|
|
|
echo LD_LIBRARY_PATH=$(pwd)/python/install/lib:$LD_LIBRARY_PATH >> $GITHUB_ENV
|
|
|
|
echo PYTHONHOME=$(pwd)/python/install >> $GITHUB_ENV
|
|
|
|
echo PYO3_PYTHON=$(pwd)/python/install/bin/python3 >> $GITHUB_ENV
|
|
|
|
- run: python3 -m sysconfig
|
|
|
|
- run: python3 -m pip install --upgrade pip && pip install nox
|
|
|
|
- run: |
|
|
|
|
PYO3_CONFIG_FILE=$(mktemp)
|
|
|
|
cat > $PYO3_CONFIG_FILE << EOF
|
|
|
|
implementation=CPython
|
2023-10-04 18:43:23 +00:00
|
|
|
version=3.12
|
2023-09-04 18:46:29 +00:00
|
|
|
shared=true
|
|
|
|
abi3=false
|
2023-10-04 18:43:23 +00:00
|
|
|
lib_name=python3.12d
|
2023-09-04 18:46:29 +00:00
|
|
|
lib_dir=${{ github.workspace }}/python/install/lib
|
|
|
|
executable=${{ github.workspace }}/python/install/bin/python3
|
|
|
|
pointer_width=64
|
|
|
|
build_flags=Py_DEBUG,Py_REF_DEBUG
|
|
|
|
suppress_build_script_link_lines=false
|
|
|
|
EOF
|
|
|
|
echo PYO3_CONFIG_FILE=$PYO3_CONFIG_FILE >> $GITHUB_ENV
|
|
|
|
- run: python3 -m nox -s test
|
|
|
|
|
2024-02-13 21:52:53 +00:00
|
|
|
test-version-limits:
|
|
|
|
needs: [fmt]
|
2024-02-23 00:51:50 +00:00
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
2024-02-13 21:52:53 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
2024-02-23 00:51:50 +00:00
|
|
|
with:
|
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2024-02-13 21:52:53 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- run: python3 -m pip install --upgrade pip && pip install nox
|
|
|
|
- run: python3 -m nox -s test-version-limits
|
|
|
|
|
2024-02-22 08:05:37 +00:00
|
|
|
check-feature-powerset:
|
2024-07-10 11:36:31 +00:00
|
|
|
needs: [fmt, resolve]
|
2024-02-23 00:51:50 +00:00
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
2024-02-22 08:05:37 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-07-10 11:36:31 +00:00
|
|
|
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 }}
|
2024-02-22 08:05:37 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
2024-02-23 00:51:50 +00:00
|
|
|
with:
|
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2024-07-10 11:36:31 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
2024-02-22 08:05:37 +00:00
|
|
|
with:
|
2024-07-10 11:36:31 +00:00
|
|
|
toolchain: stable
|
|
|
|
- uses: taiki-e/install-action@v2
|
|
|
|
with:
|
|
|
|
tool: cargo-hack,cargo-minimal-versions
|
2024-02-22 08:05:37 +00:00
|
|
|
- run: python3 -m pip install --upgrade pip && pip install nox
|
2024-07-10 11:36:31 +00:00
|
|
|
- run: python3 -m nox -s check-feature-powerset -- ${{ matrix.rust != 'stable' && 'minimal-versions' || '' }}
|
2024-02-22 08:05:37 +00:00
|
|
|
|
2024-02-26 21:47:35 +00:00
|
|
|
test-cross-compilation:
|
|
|
|
needs: [fmt]
|
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
name: test-cross-compilation ${{ matrix.os }} -> ${{ matrix.target }}
|
|
|
|
strategy:
|
|
|
|
# If one platform fails, allow the rest to keep testing if `CI-no-fail-fast` label is present
|
|
|
|
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
# ubuntu "cross compile" to itself
|
|
|
|
- os: "ubuntu-latest"
|
|
|
|
target: "x86_64-unknown-linux-gnu"
|
|
|
|
flags: "-i python3.12"
|
|
|
|
manylinux: auto
|
|
|
|
# ubuntu x86_64 -> aarch64
|
|
|
|
- os: "ubuntu-latest"
|
|
|
|
target: "aarch64-unknown-linux-gnu"
|
|
|
|
flags: "-i python3.12"
|
|
|
|
manylinux: auto
|
|
|
|
# ubuntu x86_64 -> windows x86_64
|
|
|
|
- os: "ubuntu-latest"
|
|
|
|
target: "x86_64-pc-windows-gnu"
|
|
|
|
flags: "-i python3.12 --features abi3 --features generate-import-lib"
|
|
|
|
manylinux: off
|
|
|
|
# macos x86_64 -> aarch64
|
|
|
|
- os: "macos-13" # last x86_64 macos runners
|
|
|
|
target: "aarch64-apple-darwin"
|
|
|
|
# macos aarch64 -> x86_64
|
|
|
|
- os: "macos-14" # aarch64 macos runners
|
|
|
|
target: "x86_64-apple-darwin"
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
|
|
|
workspaces:
|
|
|
|
examples/maturin-starter
|
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
2024-03-19 08:14:42 +00:00
|
|
|
key: ${{ matrix.target }}
|
2024-02-26 21:47:35 +00:00
|
|
|
- name: Setup cross-compiler
|
|
|
|
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
|
|
|
run: sudo apt-get install -y mingw-w64 llvm
|
|
|
|
- uses: PyO3/maturin-action@v1
|
|
|
|
with:
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
manylinux: ${{ matrix.manylinux }}
|
|
|
|
args: --release -m examples/maturin-starter/Cargo.toml ${{ matrix.flags }}
|
|
|
|
|
|
|
|
test-cross-compilation-windows:
|
|
|
|
needs: [fmt]
|
|
|
|
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || github.event_name != 'pull_request' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
|
|
|
workspaces:
|
|
|
|
examples/maturin-starter
|
|
|
|
save-if: ${{ github.event_name != 'merge_group' }}
|
|
|
|
- uses: actions/cache/restore@v4
|
|
|
|
with:
|
|
|
|
# https://github.com/PyO3/maturin/discussions/1953
|
|
|
|
path: ~/.cache/cargo-xwin
|
|
|
|
key: cargo-xwin-cache
|
|
|
|
- name: Test cross compile to Windows
|
|
|
|
env:
|
|
|
|
XWIN_ARCH: x86_64
|
|
|
|
run: |
|
|
|
|
set -ex
|
|
|
|
sudo apt-get install -y mingw-w64 llvm
|
|
|
|
rustup target add x86_64-pc-windows-gnu x86_64-pc-windows-msvc
|
|
|
|
pip install cargo-xwin
|
|
|
|
# abi3
|
|
|
|
cargo build --manifest-path examples/maturin-starter/Cargo.toml --features abi3 --target x86_64-pc-windows-gnu
|
|
|
|
cargo xwin build --manifest-path examples/maturin-starter/Cargo.toml --features abi3 --target x86_64-pc-windows-msvc
|
|
|
|
# non-abi3
|
|
|
|
export PYO3_CROSS_PYTHON_VERSION=3.12
|
|
|
|
cargo build --manifest-path examples/maturin-starter/Cargo.toml --features generate-import-lib --target x86_64-pc-windows-gnu
|
|
|
|
cargo xwin build --manifest-path examples/maturin-starter/Cargo.toml --features generate-import-lib --target x86_64-pc-windows-msvc
|
|
|
|
- if: ${{ github.ref == 'refs/heads/main' }}
|
|
|
|
uses: actions/cache/save@v4
|
|
|
|
with:
|
|
|
|
path: ~/.cache/cargo-xwin
|
|
|
|
key: cargo-xwin-cache
|
2022-11-20 13:23:05 +00:00
|
|
|
conclusion:
|
|
|
|
needs:
|
|
|
|
- fmt
|
2023-06-04 21:58:44 +00:00
|
|
|
- check-msrv
|
2022-11-20 13:23:05 +00:00
|
|
|
- clippy
|
2022-11-21 02:52:31 +00:00
|
|
|
- build-pr
|
|
|
|
- build-full
|
2022-11-20 13:23:05 +00:00
|
|
|
- valgrind
|
|
|
|
- careful
|
2024-01-02 09:03:11 +00:00
|
|
|
- docsrs
|
2022-11-20 13:23:05 +00:00
|
|
|
- coverage
|
|
|
|
- emscripten
|
2024-02-13 21:52:53 +00:00
|
|
|
- test-debug
|
|
|
|
- test-version-limits
|
2024-02-22 08:05:37 +00:00
|
|
|
- check-feature-powerset
|
2024-02-26 21:47:35 +00:00
|
|
|
- test-cross-compilation
|
|
|
|
- test-cross-compilation-windows
|
2022-11-20 13:23:05 +00:00
|
|
|
if: always()
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Result
|
|
|
|
run: |
|
|
|
|
jq -C <<< "${needs}"
|
|
|
|
# Check if all needs were successful or skipped.
|
|
|
|
"$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")"
|
|
|
|
env:
|
|
|
|
needs: ${{ toJson(needs) }}
|