skip 3.13 test on numpy 1 #938
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
continue-on-error: true | |
- run: ./x.py check | |
test: | |
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} | |
runs-on: ${{ matrix.platform.os }} | |
needs: [lint, check-msrv, examples] | |
strategy: | |
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }} | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
platform: | |
[ | |
{ | |
os: "ubuntu-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-unknown-linux-gnu", | |
}, | |
{ | |
os: "macOS-13", | |
python-architecture: "x64", | |
rust-target: "x86_64-apple-darwin", | |
}, | |
{ | |
os: "windows-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-pc-windows-msvc", | |
}, | |
] | |
include: | |
# ubuntu-24.04 does not support 3.7 | |
- python-version: 3.7 | |
platform: | |
{ | |
os: "ubuntu-22.04", | |
python-architecture: "x64", | |
rust-target: "x86_64-unknown-linux-gnu", | |
} | |
# Older versions of CPython are not available for AArch64. | |
- python-version: 3.12 | |
platform: | |
{ | |
os: "macOS-latest", | |
python-architecture: "arm64", | |
rust-target: "aarch64-apple-darwin", | |
} | |
# NumPy does not provide pre-built wheels for PyPy on macOS and Windows | |
- python-version: pypy-3.7 | |
platform: | |
{ | |
os: "ubuntu-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-unknown-linux-gnu", | |
} | |
- python-version: pypy-3.8 | |
platform: | |
{ | |
os: "ubuntu-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-unknown-linux-gnu", | |
} | |
exclude: | |
# ubuntu-24.04 does not support 3.7 | |
- python-version: 3.7 | |
platform: | |
{ | |
os: "ubuntu-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-unknown-linux-gnu", | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.platform.python-architecture }} | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.platform.rust-target }} | |
- name: Test | |
run: | | |
pip install "numpy" ml_dtypes | |
cargo test --all-features | |
# Not on PyPy, because no embedding API | |
if: ${{ !startsWith(matrix.python-version, 'pypy') }} | |
- name: Test example | |
run: | | |
pip install nox | |
nox -f examples/simple/noxfile.py | |
env: | |
CARGO_TERM_VERBOSE: true | |
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }} | |
RUST_BACKTRACE: 1 | |
test-numpy1: | |
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} numpy1 | |
runs-on: ${{ matrix.platform.os }} | |
needs: [lint, check-msrv, examples] | |
strategy: | |
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }} | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
platform: | |
[ | |
{ | |
os: "ubuntu-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-unknown-linux-gnu", | |
}, | |
{ | |
os: "macOS-13", | |
python-architecture: "x64", | |
rust-target: "x86_64-apple-darwin", | |
}, | |
{ | |
os: "windows-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-pc-windows-msvc", | |
}, | |
] | |
include: | |
# ubuntu-24.04 does not support 3.7 | |
- python-version: 3.7 | |
platform: | |
{ | |
os: "ubuntu-22.04", | |
python-architecture: "x64", | |
rust-target: "x86_64-unknown-linux-gnu", | |
} | |
exclude: | |
# ubuntu-24.04 does not support 3.7 | |
- python-version: 3.7 | |
platform: | |
{ | |
os: "ubuntu-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-unknown-linux-gnu", | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.platform.python-architecture }} | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.platform.rust-target }} | |
- name: Test | |
run: | | |
pip install "numpy<2" ml_dtypes | |
cargo test --all-features | |
- name: Test example | |
run: | | |
pip install nox | |
nox -f examples/simple/noxfile.py | |
env: | |
CARGO_TERM_VERBOSE: true | |
RUST_BACKTRACE: 1 | |
cross-build: | |
runs-on: ubuntu-latest | |
needs: [lint, check-msrv, examples] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- uses: messense/maturin-action@v1 | |
with: | |
target: aarch64 | |
manylinux: auto | |
args: --manifest-path examples/simple/Cargo.toml | |
valgrind: | |
runs-on: ubuntu-latest | |
needs: [lint, check-msrv, examples] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
continue-on-error: true | |
- uses: taiki-e/install-action@valgrind | |
- run: | | |
pip install "numpy" ml_dtypes | |
cargo test --all-features --release | |
env: | |
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: valgrind --leak-check=no --error-exitcode=1 | |
careful: | |
runs-on: ubuntu-latest | |
needs: [lint, check-msrv, examples] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: Swatinem/rust-cache@v2 | |
continue-on-error: true | |
- uses: taiki-e/install-action@cargo-careful | |
- run: | | |
pip install "numpy" ml_dtypes | |
cargo careful test --all-features | |
check-msrv: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: examples/simple | |
continue-on-error: true | |
- name: Install toml | |
run: pip install toml | |
- name: Edit Cargo.toml | |
run: | | |
import toml | |
cargo_toml = toml.load("Cargo.toml") | |
cargo_toml["dependencies"]["ndarray"] = "0.15.6" | |
with open("Cargo.toml", "w") as f: | |
toml.dump(cargo_toml, f) | |
working-directory: examples/simple | |
shell: python | |
- name: Generate lockfile | |
run: cargo generate-lockfile | |
working-directory: examples/simple | |
- name: Unify dependencies to MSRV-compatible versions | |
run: | | |
import toml | |
import subprocess | |
cargo_lock = toml.load("Cargo.lock") | |
for pkg in cargo_lock["package"]: | |
pkg_id = pkg["name"] + ":" + pkg["version"] | |
if pkg["name"] == "ndarray" and pkg["version"] != "0.15.6": | |
subprocess.run(["cargo", "update", "--package", pkg_id, "--precise", "0.15.6"], check=True) | |
working-directory: examples/simple | |
shell: python | |
- name: Test example | |
run: | | |
pip install nox | |
nox -f examples/simple/noxfile.py | |
examples: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install OpenBLAS | |
run: sudo apt install --yes libopenblas-dev | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
continue-on-error: true | |
- name: Test examples | |
run: | | |
pip install nox | |
nox -f examples/linalg/noxfile.py | |
nox -f examples/parallel/noxfile.py | |
coverage: | |
runs-on: ubuntu-latest | |
needs: [lint, check-msrv, examples] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install numpy | |
run: pip install "numpy" ml_dtypes | |
- uses: Swatinem/rust-cache@v2 | |
continue-on-error: true | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: llvm-tools-preview | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Generate code coverage | |
run: cargo llvm-cov --all-features --codecov --output-path coverage.json | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: coverage.json | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true |