Skip to content

Commit 8b7ce5c

Browse files
committed
Include PyPy in the test matrix.
This requires removing the Poetry lockfiles as it appears impossible to have a single lock spanning such a diverse set of Python interpreters.
1 parent 9d33e3b commit 8b7ce5c

File tree

6 files changed

+49
-505
lines changed

6 files changed

+49
-505
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,48 +31,58 @@ jobs:
3131
runs-on: ${{ matrix.platform.os }}
3232
needs: [lint, check-msrv, linalg-example]
3333
strategy:
34-
max-parallel: 16
34+
fail-fast: false
3535
matrix:
36-
python-version: [3.6, 3.7, 3.8, 3.9]
36+
python-version: [3.7, 3.8, 3.9]
3737
platform: [
3838
{ os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" },
3939
{ os: "macOS-latest", python-architecture: "x64", rust-target: "x86_64-apple-darwin" },
4040
{ os: "windows-latest", python-architecture: "x64", rust-target: "x86_64-pc-windows-msvc" },
4141
{ os: "windows-latest", python-architecture: "x86", rust-target: "i686-pc-windows-msvc" },
4242
]
43+
include:
44+
# PyPy and NumPy on macOS and Windows is too slow and brittle
45+
- python-version: pypy-3.7
46+
platform: { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }
47+
- python-version: pypy-3.8
48+
platform: { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }
4349
steps:
4450
- uses: actions/checkout@v2
4551
- name: Set up Python ${{ matrix.python-version }}
4652
uses: actions/setup-python@v2
4753
with:
4854
python-version: ${{ matrix.python-version }}
55+
architecture: ${{ matrix.platform.python-architecture }}
4956
- name: Install Rust
5057
uses: actions-rs/toolchain@v1
5158
with:
5259
toolchain: stable
60+
profile: minimal
61+
target: ${{ matrix.platform.rust-target }}
5362
default: true
54-
- run: rustup set default-host ${{ matrix.platform.rust-target }}
63+
- name: Enable Cargo resolver v2 to avoid PyO3 features missing in PyPy
64+
run: echo 'resolver = "2"' >> Cargo.toml
5565
- name: Build without default features
56-
run: cargo build --no-default-features --verbose
66+
run: cargo build --no-default-features
5767
- name: Build with default features
58-
run: cargo build --verbose
59-
- name: Install test dependencies
60-
run: |
61-
python -m pip install --upgrade pip
62-
pip install maturin numpy poetry
68+
run: cargo build
6369
- name: Run cargo test
64-
run: cargo test --verbose
65-
- name: Test Examples
6670
run: |
67-
for example_dir in 'examples/simple-extension'; do
68-
pushd $example_dir && \
69-
poetry install && \
70-
poetry run maturin develop && \
71-
poetry run pytest && \
72-
popd
73-
done
74-
shell: bash
71+
pip install numpy
72+
cargo test
73+
# Not on PyPy, because no embedding API
74+
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
75+
- name: Install poetry
76+
run: pip install poetry
77+
- name: Test example
78+
run: |
79+
poetry install
80+
poetry run maturin develop
81+
poetry run pytest
82+
working-directory: examples/simple-extension
7583
env:
84+
CARGO_TERM_VERBOSE: true
85+
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}
7686
RUST_BACKTRACE: 1
7787

7888
check-msrv:
@@ -93,8 +103,8 @@ jobs:
93103
with:
94104
working-directory: examples/simple-extension
95105
continue-on-error: true
96-
- name: Install maturin, poetry, and toml
97-
run: pip install maturin poetry toml
106+
- name: Install toml and poetry
107+
run: pip install toml poetry
98108
- name: Edit Cargo.toml and detach from workspace
99109
run: |
100110
import toml
@@ -111,11 +121,12 @@ jobs:
111121
cargo generate-lockfile
112122
cargo update -p $(cargo pkgid -p ndarray 2>&1 >/dev/null | grep 0.15 | sed -e 's/^[ \t]*//') --precise 0.13.1
113123
working-directory: examples/simple-extension
114-
- name: Test Example
124+
- name: Test example
115125
run: |
116-
poetry install && poetry run maturin develop && poetry run pytest
126+
poetry install
127+
poetry run maturin develop
128+
poetry run pytest
117129
working-directory: examples/simple-extension
118-
shell: bash
119130

120131
linalg-example:
121132
runs-on: ubuntu-latest
@@ -134,11 +145,11 @@ jobs:
134145
toolchain: stable
135146
- uses: Swatinem/rust-cache@v1
136147
continue-on-error: true
137-
- name: Install maturin and poetry
138-
run: pip install maturin poetry
139-
- name: Test Examples
148+
- name: Install poetry
149+
run: pip install poetry
150+
- name: Test example
140151
run: |
141-
cd examples/linalg && \
142-
poetry install && \
143-
poetry run maturin develop && \
152+
poetry install
153+
poetry run maturin develop
144154
poetry run pytest
155+
working-directory: examples/linalg

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ build/
1414
*.so
1515
*.egg-info/
1616
**/dist/
17-
__pycache__
17+
__pycache__
18+
poetry.lock

examples/linalg/poetry.lock

Lines changed: 0 additions & 235 deletions
This file was deleted.

examples/linalg/pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
22
build-backend = "maturin"
3-
requires = ["poetry_core>=1.0.0"]
3+
requires = ["maturin>=0.12,<0.13"]
44

55
[tool.poetry]
66
name = "numpy-linalg-example"
@@ -10,7 +10,8 @@ authors = ["Yuji Kanagawa <[email protected]>"]
1010

1111
[tool.poetry.dependencies]
1212
numpy = ">=1.18"
13-
python = ">=3.6"
13+
python = ">=3.7,<3.11"
1414

1515
[tool.poetry.dev-dependencies]
16+
maturin = ">=0.12,<0.13"
1617
pytest = "^6.1"

0 commit comments

Comments
 (0)