1717 toolchain : stable
1818 profile : minimal
1919 components : rustfmt, clippy
20+ default : true
2021 - uses : Swatinem/rust-cache@v1
2122 continue-on-error : true
2223 - env :
4142 { os: "windows-latest", python-architecture: "x86", rust-target: "i686-pc-windows-msvc" },
4243 ]
4344 include :
44- # PyPy and NumPy on macOS and Windows is too slow and brittle
45+ # NumPy does not provide pre-built wheels for PyPy on macOS and Windows
4546 - python-version : pypy-3.7
4647 platform : { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }
4748 - python-version : pypy-3.8
@@ -60,30 +61,36 @@ jobs:
6061 profile : minimal
6162 target : ${{ matrix.platform.rust-target }}
6263 default : true
63- - name : Enable Cargo resolver v2 to avoid PyO3 features missing in PyPy
64- run : echo 'resolver = "2"' >> Cargo.toml
64+ - name : Install toml
65+ run : pip install toml
66+ - name : Edit Cargo.toml and enable new resolver
67+ run : |
68+ import toml
69+ cargo_toml = toml.load("Cargo.toml")
70+ cargo_toml["workspace"]["resolver"] = "2"
71+ with open("Cargo.toml", "w") as f:
72+ toml.dump(cargo_toml, f)
73+ shell : python
6574 - name : Build without default features
6675 run : cargo build --no-default-features
6776 - name : Build with default features
6877 run : cargo build
69- - name : Run cargo test
78+ - name : Test
7079 run : |
7180 pip install numpy
7281 cargo test
7382 # Not on PyPy, because no embedding API
7483 if : ${{ !startsWith(matrix.python-version, 'pypy') }}
75- - name : Install poetry
76- run : pip install poetry
7784 - name : Test example
7885 run : |
79- poetry install
80- poetry run maturin develop
81- poetry run pytest
86+ pip install tox
87+ tox
8288 working-directory : examples/simple-extension
8389 env :
8490 CARGO_TERM_VERBOSE : true
8591 CARGO_BUILD_TARGET : ${{ matrix.platform.rust-target }}
8692 RUST_BACKTRACE : 1
93+ TOX_TESTENV_PASSENV : CARGO_BUILD_TARGET
8794
8895 check-msrv :
8996 runs-on : ubuntu-latest
@@ -93,18 +100,18 @@ jobs:
93100 uses : actions/setup-python@v2
94101 with :
95102 python-version : 3.8
96- - name : Install MSRV Rust
103+ - name : Install Rust
97104 uses : actions-rs/toolchain@v1
98105 with :
99- profile : minimal
100106 toolchain : 1.48.0
107+ profile : minimal
101108 default : true
102109 - uses : Swatinem/rust-cache@v1
103110 with :
104111 working-directory : examples/simple-extension
105112 continue-on-error : true
106- - name : Install toml and poetry
107- run : pip install toml poetry
113+ - name : Install toml
114+ run : pip install toml
108115 - name : Edit Cargo.toml and detach from workspace
109116 run : |
110117 import toml
@@ -116,16 +123,24 @@ jobs:
116123 toml.dump(cargo_toml, f)
117124 working-directory : examples/simple-extension
118125 shell : python
119- - name : Use ndarray 0.13.1
126+ - name : Generate lockfile
127+ run : cargo generate-lockfile
128+ working-directory : examples/simple-extension
129+ - name : Unify dependencies on ndarray to 0.13.1
120130 run : |
121- cargo generate-lockfile
122- cargo update -p $(cargo pkgid -p ndarray 2>&1 >/dev/null | grep 0.15 | sed -e 's/^[ \t]*//') --precise 0.13.1
131+ import toml
132+ import subprocess
133+ cargo_lock = toml.load("Cargo.lock")
134+ for pkg in cargo_lock["package"]:
135+ if pkg["name"] == "ndarray" and pkg["version"] != "0.13.1":
136+ pkg_id = pkg["name"] + ":" + pkg["version"]
137+ subprocess.run(["cargo", "update", "--package", pkg_id, "--precise", "0.13.1"], check=True)
123138 working-directory : examples/simple-extension
139+ shell : python
124140 - name : Test example
125141 run : |
126- poetry install
127- poetry run maturin develop
128- poetry run pytest
142+ pip install tox
143+ tox
129144 working-directory : examples/simple-extension
130145
131146 linalg-example :
@@ -143,13 +158,12 @@ jobs:
143158 uses : actions-rs/toolchain@v1
144159 with :
145160 toolchain : stable
161+ profile : minimal
162+ default : true
146163 - uses : Swatinem/rust-cache@v1
147164 continue-on-error : true
148- - name : Install poetry
149- run : pip install poetry
150165 - name : Test example
151166 run : |
152- poetry install
153- poetry run maturin develop
154- poetry run pytest
167+ pip install tox
168+ tox
155169 working-directory : examples/linalg
0 commit comments