1
+ name : Python - Test & Release Package
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - ' *'
7
+
8
+ concurrency :
9
+ group : ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress : true
11
+
12
+ env :
13
+ PACKAGE_NAME : chidori
14
+ PYTHON_VERSION : " 3.9" # to build abi3 wheels
15
+
16
+ jobs :
17
+ python-macos :
18
+ runs-on : macos-latest
19
+ strategy :
20
+ matrix :
21
+ target : [x86_64]
22
+ steps :
23
+ - uses : actions/checkout@v3
24
+ - uses : actions/setup-python@v4
25
+ with :
26
+ python-version : ${{ env.PYTHON_VERSION }}
27
+ architecture : x64
28
+ - name : Install Rust toolchain
29
+ uses : actions-rs/toolchain@v1
30
+ with :
31
+ toolchain : stable
32
+ profile : minimal
33
+ default : true
34
+ - name : Set up cargo cache
35
+ uses : actions/cache@v3
36
+ continue-on-error : false
37
+ with :
38
+ path : |
39
+ ~/.cargo/bin/
40
+ ~/.cargo/registry/index/
41
+ ~/.cargo/registry/cache/
42
+ ~/.cargo/git/db/
43
+ toolchain/target/
44
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
45
+ restore-keys : ${{ runner.os }}-cargo-
46
+ - name : Build wheels - x86_64
47
+ uses : messense/maturin-action@v1
48
+ with :
49
+ target : ${{ matrix.target }}
50
+ args : --release --out dist --features python
51
+ maturin-version : " v0.13.0"
52
+ working-directory : toolchain/chidori
53
+ sccache : true
54
+ - name : Install built wheel - x86_64
55
+ working-directory : toolchain/chidori
56
+ run : |
57
+ pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
58
+ pip install pytest pytest-mock pytest-asyncio
59
+ pytest -v
60
+ - name : Upload wheels
61
+ uses : actions/upload-artifact@v3
62
+ with :
63
+ name : wheels
64
+ path : toolchain/chidori/dist
65
+
66
+ python-macos-universal :
67
+ runs-on : macos-latest
68
+ strategy :
69
+ matrix :
70
+ target : [x86_64]
71
+ steps :
72
+ - uses : actions/checkout@v3
73
+ - uses : actions/setup-python@v4
74
+ with :
75
+ python-version : ${{ env.PYTHON_VERSION }}
76
+ architecture : x64
77
+ - name : Install Rust toolchain
78
+ uses : actions-rs/toolchain@v1
79
+ with :
80
+ toolchain : stable
81
+ profile : minimal
82
+ default : true
83
+ - name : Set up cargo cache
84
+ uses : actions/cache@v3
85
+ continue-on-error : false
86
+ with :
87
+ path : |
88
+ ~/.cargo/bin/
89
+ ~/.cargo/registry/index/
90
+ ~/.cargo/registry/cache/
91
+ ~/.cargo/git/db/
92
+ toolchain/target/
93
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
94
+ restore-keys : ${{ runner.os }}-cargo-
95
+ - name : Build wheels - universal2
96
+ uses : messense/maturin-action@v1
97
+ with :
98
+ args : --release --universal2 --out dist --features python
99
+ maturin-version : " v0.13.0"
100
+ working-directory : toolchain/chidori
101
+ sccache : true
102
+ - name : Install built wheel - universal2
103
+ working-directory : toolchain/chidori
104
+ run : |
105
+ pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall
106
+ pip install pytest pytest-mock pytest-asyncio
107
+ pytest -v
108
+ - name : Upload wheels
109
+ uses : actions/upload-artifact@v3
110
+ with :
111
+ name : wheels
112
+ path : toolchain/chidori/dist
113
+
114
+ python-windows :
115
+ runs-on : windows-latest
116
+ strategy :
117
+ matrix :
118
+ target : [x64]
119
+ steps :
120
+ - uses : actions/checkout@v3
121
+ - uses : actions/setup-python@v4
122
+ with :
123
+ python-version : ${{ env.PYTHON_VERSION }}
124
+ architecture : ${{ matrix.target }}
125
+ - name : Install Rust toolchain
126
+ uses : actions-rs/toolchain@v1
127
+ with :
128
+ toolchain : stable
129
+ profile : minimal
130
+ default : true
131
+ - name : Set up cargo cache
132
+ uses : actions/cache@v3
133
+ continue-on-error : false
134
+ with :
135
+ path : |
136
+ ~/.cargo/bin/
137
+ ~/.cargo/registry/index/
138
+ ~/.cargo/registry/cache/
139
+ ~/.cargo/git/db/
140
+ toolchain/target/
141
+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
142
+ restore-keys : ${{ runner.os }}-cargo-
143
+ - name : Build wheels
144
+ uses : messense/maturin-action@v1
145
+ with :
146
+ target : ${{ matrix.target }}
147
+ args : --release --out dist --features python
148
+ maturin-version : " v0.13.0"
149
+ working-directory : toolchain/chidori
150
+ sccache : true
151
+ - name : Install built wheel
152
+ shell : bash
153
+ working-directory : toolchain/chidori
154
+ run : |
155
+ python -m pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
156
+ pip install pytest pytest-mock pytest-asyncio
157
+ python -m pytest -v
158
+ - name : Upload wheels
159
+ uses : actions/upload-artifact@v3
160
+ with :
161
+ name : wheels
162
+ path : toolchain/chidori/dist
163
+
164
+ python-linux :
165
+ runs-on : ubuntu-latest
166
+ strategy :
167
+ matrix :
168
+ target : [x86_64]
169
+ steps :
170
+ - uses : actions/checkout@v3
171
+ - uses : actions/setup-python@v4
172
+ with :
173
+ python-version : ${{ env.PYTHON_VERSION }}
174
+ architecture : x64
175
+ - name : Build wheels
176
+ uses : messense/maturin-action@v1
177
+ with :
178
+ target : ${{ matrix.target }}
179
+ manylinux : auto
180
+ args : --release --out dist --features python
181
+ maturin-version : " v0.13.0"
182
+ working-directory : toolchain/chidori
183
+ sccache : true
184
+ - name : Install built wheel
185
+ working-directory : toolchain/chidori
186
+ if : matrix.target == 'x86_64'
187
+ run : |
188
+ pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
189
+ pip install pytest pytest-mock pytest-asyncio
190
+ pytest -v
191
+ - name : Upload wheels
192
+ uses : actions/upload-artifact@v3
193
+ with :
194
+ name : wheels
195
+ path : toolchain/chidori/dist
196
+
197
+ # python-linux-cross:
198
+ # runs-on: ubuntu-latest
199
+ # strategy:
200
+ # matrix:
201
+ # target: [aarch64]
202
+ # steps:
203
+ # - uses: actions/checkout@v3
204
+ # - uses: actions/setup-python@v4
205
+ # with:
206
+ # python-version: ${{ env.PYTHON_VERSION }}
207
+ # - name: Build wheels
208
+ # uses: messense/maturin-action@v1
209
+ # with:
210
+ # target: ${{ matrix.target }}
211
+ # manylinux: auto
212
+ # args: --release --out dist --features python
213
+ # maturin-version: "v0.13.0"
214
+ # working-directory: toolchain/chidori
215
+ # sccache: true
216
+ # - uses: uraimo/[email protected]
217
+ # if: matrix.target != 'ppc64'
218
+ # name: Install built wheel
219
+ # with:
220
+ # arch: ${{ matrix.target }}
221
+ # distro: ubuntu20.04
222
+ # githubToken: ${{ github.token }}
223
+ # install: |
224
+ # apt-get update
225
+ # apt-get install -y --no-install-recommends python3 python3-pip
226
+ # pip3 install -U pip
227
+ # run: |
228
+ # pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
229
+ # pip install pytest pytest-mock pytest-asyncio
230
+ # pytest -v
231
+ # - name: Upload wheels
232
+ # uses: actions/upload-artifact@v3
233
+ # with:
234
+ # name: wheels
235
+ # path: toolchain/chidori/dist
236
+ release :
237
+ name : Release
238
+ runs-on : ubuntu-latest
239
+ needs :
240
+ - python-macos
241
+ - python-macos-universal
242
+ - python-windows
243
+ - python-linux
244
+ # - python-linux-cross
245
+ # if: ${{ github.ref == 'refs/heads/main' }}
246
+ steps :
247
+ - uses : actions/download-artifact@v3
248
+ with :
249
+ name : wheels
250
+ - uses : actions/setup-python@v2
251
+ - name : Publish to PyPi
252
+ env :
253
+ TWINE_USERNAME : __token__
254
+ TWINE_PASSWORD : ${{ secrets.PYPI_TOKEN }}
255
+ run : |
256
+ pip install --upgrade twine
257
+ twine upload --skip-existing *
0 commit comments