Skip to content

Merge pull request #302 from PyO3/update-versions-manifest #785

Merge pull request #302 from PyO3/update-versions-manifest

Merge pull request #302 from PyO3/update-versions-manifest #785

Workflow file for this run

name: Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
- name: npm install
run: npm install
- name: lint
run: npm run lint
test:
name: Test Suite
runs-on: ${{ matrix.os }}
needs: [lint]
env:
RUST_BACKTRACE: '1'
strategy:
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
matrix:
os:
- ubuntu-24.04
- macos-13
- windows-latest
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: PyO3/maturin
ref: main
path: maturin
- uses: dtolnay/rust-toolchain@stable
- name: maturin build
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
args: -o dist
working-directory: maturin/test-crates/pyo3-mixed
before-script-linux: |
sudo apt-get update
sudo apt-get install -y libclang-dev
- name: maturin build universal2 target
if: startsWith(matrix.os, 'macos')
uses: ./
with:
target: universal2
working-directory: maturin/test-crates/pyo3-mixed
- name: maturin build universal2
if: startsWith(matrix.os, 'macos')
uses: ./
with:
target: universal2-apple-darwin
working-directory: maturin/test-crates/pyo3-mixed
- name: maturin build arm64
if: startsWith(matrix.os, 'macos')
uses: ./
with:
target: aarch64-apple-darwin
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml
- name: check maturin in PATH
run: maturin --help
- name: maturin build manylinux auto
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
args: -i python3.10 --out dist
working-directory: maturin/test-crates/pyo3-mixed
manylinux: 'auto'
- name: maturin build manylinux2014
uses: ./
with:
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.10 --out dist
manylinux: '2014'
before-script-linux: |
yum install -y llvm-toolset-7-clang
source /opt/rh/llvm-toolset-7/enable
- name: maturin build nightly powerpc64le musl
if: ${{ matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly' }}
uses: ./
with:
rust-toolchain: nightly
args: -m maturin/test-crates/hello-world/Cargo.toml
manylinux: 'auto'
target: 'powerpc64le-unknown-linux-musl'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: maturin build manylinux off
uses: ./
with:
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.11
manylinux: 'off'
- name: maturin build container off
uses: ./
with:
rustup-components: rustfmt
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.11
manylinux: 'off'
container: 'off'
- name: maturin build container manylinux version
uses: ./
with:
rustup-components: |
rustfmt
rust-std
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.10
manylinux: 'auto'
container: '2_17'
- name: maturin build --cargo-extra-args
uses: ./
with:
args: -m tests/pyo3-pure/Cargo.toml --features python
manylinux: 'auto'
- name: docker pull
if: matrix.os == 'ubuntu-latest'
run: docker pull quay.io/pypa/manylinux_2_28_x86_64:latest
- name: maturin build with existing docker image
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
rustup-components: rustfmt
container: quay.io/pypa/manylinux_2_28_x86_64:latest
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.10
manylinux: 'auto'
- name: maturin build --target args
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
args: -m maturin/test-crates/pyo3-pure/Cargo.toml --target aarch64-unknown-linux-gnu
- name: maturin build --zig
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
target: aarch64-unknown-linux-gnu
args: -m maturin/test-crates/pyo3-pure/Cargo.toml --zig
manylinux: 'auto'
- name: maturin build --zig container on
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
target: aarch64-unknown-linux-gnu
args: -m maturin/test-crates/pyo3-pure/Cargo.toml --zig
manylinux: 'auto'
container: 'on'
- name: maturin build --zig unsupported target
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
target: s390x-unknown-linux-gnu
args: -m maturin/test-crates/pyo3-pure/Cargo.toml --zig
manylinux: 'auto'
- name: maturin build cffi project
uses: ./
with:
args: -m maturin/test-crates/cffi-pure/Cargo.toml
manylinux: 'auto'
- run: cargo clean --manifest-path maturin/test-crates/pyo3-pure/Cargo.toml
- name: maturin build with sccache
uses: ./
with:
args: -m maturin/test-crates/pyo3-pure/Cargo.toml
manylinux: 'auto'
sccache: 'true'
test-manylinux:
name: Manylinux Test Suite
runs-on: ${{ matrix.os }}
needs: [lint]
strategy:
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
matrix:
os:
- ubuntu-latest
platform: [
{
manylinux: '2014',
target: 'x86_64', # Test target alias
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: '2_35', # no docker images
target: 'x86_64',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: '2014',
target: 'i686-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: '2014',
target: 'aarch64-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-pure' # abi3
},
{
manylinux: '2014',
target: 'armv7-unknown-linux-gnueabihf',
test-crate: 'maturin/test-crates/pyo3-pure' # abi3
},
{
manylinux: '2014',
target: 'powerpc64le-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: 'manylinux_2_24',
target: 'powerpc64le-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: 'manylinux_2_28',
target: 'aarch64-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: 'manylinux2014',
target: 's390x',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: 'auto',
target: 'x86_64-unknown-linux-musl', # MUSL
test-crate: 'maturin/test-crates/hello-world' # binary
},
{
manylinux: 'musllinux_1_1',
target: 'x86_64',
test-crate: 'maturin/test-crates/pyo3-pure'
},
{
manylinux: 'musllinux_1_2',
target: 'x86_64-unknown-linux-musl', # MUSL
test-crate: 'maturin/test-crates/hello-world' # binary
},
]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: PyO3/maturin
path: maturin
- name: Set up QEMU
uses: dbhi/qus/action@main
- name: maturin build
uses: ./
env:
RUST_BACKTRACE: '1'
with:
container: ${{ matrix.platform.container }}
# Test docker-options
docker-options: |
-e FOO=bar
-e RUNNER_OS
rust-toolchain: ${{ matrix.toolchain }}
working-directory: ${{ matrix.platform.test-crate }}
args: -i python3.8
manylinux: ${{ matrix.platform.manylinux }}
target: ${{ matrix.platform.target }}
- name: setup rust-toolchain
run: echo ${{ matrix.toolchain }} > ${{ matrix.platform.test-crate }}/rust-toolchain
- name: maturin build rust-toolchain
uses: ./
env:
RUST_BACKTRACE: '1'
with:
container: ${{ matrix.platform.container }}
args: -m ${{ matrix.platform.test-crate }}/Cargo.toml -i python3.8
manylinux: ${{ matrix.platform.manylinux }}
target: ${{ matrix.platform.target }}
- name: setup rust-toolchain.toml
run: |
echo "[toolchain]
channel = \"${{ matrix.toolchain }}\"
" > ${{ matrix.platform.test-crate }}/rust-toolchain.toml
- name: maturin build rust-toolchain.toml
uses: ./
env:
RUST_BACKTRACE: '1'
with:
container: ${{ matrix.platform.container }}
args: -m ${{ matrix.platform.test-crate }}/Cargo.toml -i python3.8
manylinux: ${{ matrix.platform.manylinux }}
target: ${{ matrix.platform.target }}
- name: setup rust-toolchain with toml content
run: |
set -ex
rm ${{ matrix.platform.test-crate }}/rust-toolchain*
echo "[toolchain]
channel = \"${{ matrix.toolchain }}\"
" > ${{ matrix.platform.test-crate }}/rust-toolchain
- name: maturin build rust-toolchain with toml content
uses: ./
env:
RUST_BACKTRACE: '1'
with:
container: ${{ matrix.platform.container }}
args: -m ${{ matrix.platform.test-crate }}/Cargo.toml -i python3.8
manylinux: ${{ matrix.platform.manylinux }}
target: ${{ matrix.platform.target }}
all-green:
needs:
- lint
- test
- test-manylinux
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) }}