17
17
toolchain : stable
18
18
profile : minimal
19
19
components : rustfmt, clippy
20
+ default : true
20
21
- uses : Swatinem/rust-cache@v1
21
22
continue-on-error : true
22
23
- env :
41
42
{ os: "windows-latest", python-architecture: "x86", rust-target: "i686-pc-windows-msvc" },
42
43
]
43
44
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
45
46
- python-version : pypy-3.7
46
47
platform : { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }
47
48
- python-version : pypy-3.8
@@ -60,30 +61,36 @@ jobs:
60
61
profile : minimal
61
62
target : ${{ matrix.platform.rust-target }}
62
63
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
65
74
- name : Build without default features
66
75
run : cargo build --no-default-features
67
76
- name : Build with default features
68
77
run : cargo build
69
- - name : Run cargo test
78
+ - name : Test
70
79
run : |
71
80
pip install numpy
72
81
cargo test
73
82
# Not on PyPy, because no embedding API
74
83
if : ${{ !startsWith(matrix.python-version, 'pypy') }}
75
- - name : Install poetry
76
- run : pip install poetry
77
84
- name : Test example
78
85
run : |
79
- poetry install
80
- poetry run maturin develop
81
- poetry run pytest
86
+ pip install tox
87
+ tox
82
88
working-directory : examples/simple-extension
83
89
env :
84
90
CARGO_TERM_VERBOSE : true
85
91
CARGO_BUILD_TARGET : ${{ matrix.platform.rust-target }}
86
92
RUST_BACKTRACE : 1
93
+ TOX_TESTENV_PASSENV : CARGO_BUILD_TARGET
87
94
88
95
check-msrv :
89
96
runs-on : ubuntu-latest
@@ -93,18 +100,18 @@ jobs:
93
100
uses : actions/setup-python@v2
94
101
with :
95
102
python-version : 3.8
96
- - name : Install MSRV Rust
103
+ - name : Install Rust
97
104
uses : actions-rs/toolchain@v1
98
105
with :
99
- profile : minimal
100
106
toolchain : 1.48.0
107
+ profile : minimal
101
108
default : true
102
109
- uses : Swatinem/rust-cache@v1
103
110
with :
104
111
working-directory : examples/simple-extension
105
112
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
108
115
- name : Edit Cargo.toml and detach from workspace
109
116
run : |
110
117
import toml
@@ -116,16 +123,24 @@ jobs:
116
123
toml.dump(cargo_toml, f)
117
124
working-directory : examples/simple-extension
118
125
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
120
130
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)
123
138
working-directory : examples/simple-extension
139
+ shell : python
124
140
- name : Test example
125
141
run : |
126
- poetry install
127
- poetry run maturin develop
128
- poetry run pytest
142
+ pip install tox
143
+ tox
129
144
working-directory : examples/simple-extension
130
145
131
146
linalg-example :
@@ -143,13 +158,12 @@ jobs:
143
158
uses : actions-rs/toolchain@v1
144
159
with :
145
160
toolchain : stable
161
+ profile : minimal
162
+ default : true
146
163
- uses : Swatinem/rust-cache@v1
147
164
continue-on-error : true
148
- - name : Install poetry
149
- run : pip install poetry
150
165
- name : Test example
151
166
run : |
152
- poetry install
153
- poetry run maturin develop
154
- poetry run pytest
167
+ pip install tox
168
+ tox
155
169
working-directory : examples/linalg
0 commit comments