-
Notifications
You must be signed in to change notification settings - Fork 1
426 lines (390 loc) · 13.4 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
name: build
on:
pull_request:
push:
branches:
- "**"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
test_TAT_hpp:
name: test TAT.hpp
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: install mpi, openblas and gtest/gmock
run: sudo apt-get update && sudo apt-get install -y mpi-default-dev libopenblas-serial-dev libgtest-dev libgmock-dev
- name: make build directory
run: mkdir ${{runner.workspace}}/build
- name: configure
working-directory: ${{runner.workspace}}/build
run: cmake ${{github.workspace}} -DTAT_BUILD_PYTAT=OFF
- name: build
working-directory: ${{runner.workspace}}/build
run: make test_executables -j 2
- name: ctest
working-directory: ${{runner.workspace}}/build
run: ctest -j 2 --verbose
test_lazy_py:
name: test lazy.py
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: install pytest
run: pip install pytest pytest-cov
- name: run test
working-directory: ${{github.workspace}}/lazy_graph
run: python -m pytest
test_scalapack_py:
name: test scalapack.py
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: install mpi, scalapack
run: sudo apt-get update && sudo apt-get install -y mpi-default-dev libscalapack-mpi-dev
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: install pytest, mpi4py and numpy
run: pip install pytest pytest-cov pytest-mpi mpi4py numpy
- name: link scalapack library
working-directory: ${{github.workspace}}/PyScalapack
run: ln -s /usr/lib/x86_64-linux-gnu/libscalapack-openmpi.so libscalapack.so
- name: run test
working-directory: ${{github.workspace}}/PyScalapack
run: mpirun --oversubscribe -n 6 coverage run -m pytest && coverage combine && coverage report
env:
LD_LIBRARY_PATH: .
build_wheels_trigger:
name: trigger for building wheels
runs-on: ubuntu-latest
needs: [test_TAT_hpp, test_lazy_py, test_scalapack_py]
if: "github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || contains(toJSON(github.event.commits.*.message), '[force ci]'))"
steps:
- name: nothing
run: echo this is an empty job
generate_python_markdown_readme:
name: generate README.md for python package
runs-on: ubuntu-latest
needs: build_wheels_trigger
strategy:
fail-fast: false
matrix:
include:
- package: PyTAT
- package: tnsp_bridge
- package: lazy_graph
- package: tetragono
- package: tetraku
- package: PyScalapack
steps:
- name: checkout
uses: actions/checkout@v3
- name: install emacs
run: sudo apt-get update && sudo apt-get install -y emacs
- name: export to markdown
run: emacs ${{matrix.package}}/README.org --batch -f org-md-export-to-markdown --kill
- name: upload to artifact
uses: actions/upload-artifact@v3
with:
name: README-of-${{matrix.package}}
path: ${{matrix.package}}/README.md
build_pytat_wasm_wheels:
name: build PyTAT wheels for emscripten
runs-on: ubuntu-latest
needs: [build_wheels_trigger, generate_python_markdown_readme]
strategy:
fail-fast: false
matrix:
include:
- python: "3.11"
pyodide: "0.25.1"
- python: "3.12"
pyodide: "0.26.2"
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: recovery tag information
run: git fetch --tags --force
# See: https://github.com/actions/checkout/issues/290
- name: setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: setup node
uses: actions/setup-node@v3
- name: prepare
run: |
python -m pip install pyodide-build==${{ matrix.pyodide }}
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
pyodide config list
PYODIDE_EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
./emsdk install ${PYODIDE_EMSCRIPTEN_VERSION}
./emsdk activate ${PYODIDE_EMSCRIPTEN_VERSION}
- name: build
run: |
source emsdk/emsdk_env.sh
cd PyTAT
export SKBUILD_CMAKE_DEFINE="PYBIND11_FINDPYTHON=ON;TAT_MATH_LIBRARIES="
export CMAKE_BUILD_PARALLEL_LEVEL=4
pyodide build --exports pyinit
- name: test
run: |
cd PyTAT
npm install pyodide@$(echo ${{ matrix.pyodide }} | sed 's/a/-alpha./' | sed 's/b/-beta./')
node test_wasm.js || node test_wasm.js || node test_wasm.js || node test_wasm.js
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: emscripten
path: PyTAT/dist/*.whl
build_pytat_wheels:
name: build PyTAT wheels
runs-on: ${{ matrix.os }}
needs: [build_wheels_trigger, generate_python_markdown_readme]
strategy:
fail-fast: false
matrix:
include:
# Always support manylinux platform
- os: ubuntu-latest
python: 38
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: 39
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: 310
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: 311
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: 312
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: 38
platform_id: manylinux_aarch64
- os: ubuntu-latest
python: 39
platform_id: manylinux_aarch64
- os: ubuntu-latest
python: 310
platform_id: manylinux_aarch64
- os: ubuntu-latest
python: 311
platform_id: manylinux_aarch64
- os: ubuntu-latest
python: 312
platform_id: manylinux_aarch64
# Always support musllinux platform
- os: ubuntu-latest
python: 38
platform_id: musllinux_x86_64
- os: ubuntu-latest
python: 39
platform_id: musllinux_x86_64
- os: ubuntu-latest
python: 310
platform_id: musllinux_x86_64
- os: ubuntu-latest
python: 311
platform_id: musllinux_x86_64
- os: ubuntu-latest
python: 312
platform_id: musllinux_x86_64
- os: ubuntu-latest
python: 38
platform_id: musllinux_aarch64
- os: ubuntu-latest
python: 39
platform_id: musllinux_aarch64
- os: ubuntu-latest
python: 310
platform_id: musllinux_aarch64
- os: ubuntu-latest
python: 311
platform_id: musllinux_aarch64
- os: ubuntu-latest
python: 312
platform_id: musllinux_aarch64
# Only support the latest two version for macos platform
- os: macos-latest
python: 311
platform_id: macosx_x86_64
mac_arch: x86_64
- os: macos-latest
python: 312
platform_id: macosx_x86_64
mac_arch: x86_64
- os: macos-latest
python: 311
platform_id: macosx_arm64
mac_arch: arm64
- os: macos-latest
python: 312
platform_id: macosx_arm64
mac_arch: arm64
# Only support latest four version for windows platform
- os: windows-latest
python: 39
platform_id: win_amd64
- os: windows-latest
python: 310
platform_id: win_amd64
- os: windows-latest
python: 311
platform_id: win_amd64
- os: windows-latest
python: 312
platform_id: win_amd64
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: recovery tag information
run: git fetch --tags --force
# See: https://github.com/actions/checkout/issues/290
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: install cibuildwheel
run: python -m pip install cibuildwheel
- name: download artifacts for PyTAT
uses: actions/download-artifact@v3
with:
name: README-of-PyTAT
path: PyTAT
- name: set up qemu for linux arm64
if: "contains(matrix.platform_id, 'aarch64')"
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: build wheel for PyTAT
env:
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest {project}/PyTAT/tests
CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_ARCHS: all
CIBW_BEFORE_ALL_LINUX: yum install -y epel-release && yum install -y openblas-devel || apk add openblas-dev
CIBW_BEFORE_ALL_WINDOWS: python .github/scripts/get_openblas_for_windows.py
CIBW_BEFORE_ALL_MACOS: ""
CIBW_ENVIRONMENT_LINUX: CMAKE_BUILD_PARALLEL_LEVEL=4
CIBW_ENVIRONMENT_WINDOWS: CMAKE_BUILD_PARALLEL_LEVEL=4 SKBUILD_CMAKE_ARGS=-GNinja SKBUILD_CMAKE_DEFINE="CMAKE_C_COMPILER=clang;CMAKE_CXX_COMPILER=clang++;TAT_MATH_LIBRARIES=D:/a/TNSP/TNSP/lib/libopenblas.lib"
CIBW_ENVIRONMENT_MACOS: CMAKE_BUILD_PARALLEL_LEVEL=6 SKBUILD_CMAKE_DEFINE="CMAKE_OSX_ARCHITECTURES=${{ matrix.mac_arch }}"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: cmd /c python -m pip install delvewheel && python -m delvewheel repair --wheel-dir {dest_dir} {wheel} --add-path bin
CIBW_BUILD_VERBOSITY: 1
MACOSX_DEPLOYMENT_TARGET: 10.14
run: python -m cibuildwheel PyTAT --output-dir dist
- name: upload artifact
uses: actions/upload-artifact@v3
with:
path: dist/*.whl
build_pure_python_wheels:
name: build pure python wheels
runs-on: ubuntu-latest
needs: [build_wheels_trigger, generate_python_markdown_readme]
strategy:
fail-fast: false
matrix:
include:
- package: tnsp_bridge
- package: lazy_graph
- package: tetragono
- package: tetraku
- package: PyScalapack
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: recovery tag information
run: git fetch --tags --force
# See: https://github.com/actions/checkout/issues/290
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: install python build
run: python -m pip install build
- name: download artifacts
uses: actions/download-artifact@v3
with:
name: README-of-${{matrix.package}}
path: ${{matrix.package}}
- name: build wheel
working-directory: ${{github.workspace}}/${{matrix.package}}
run: python -m build
- name: upload artifact
uses: actions/upload-artifact@v3
with:
path: ${{github.workspace}}/${{matrix.package}}/dist/*.whl
release_trigger:
name: trigger for release
runs-on: ubuntu-latest
needs: [build_pytat_wheels, build_pytat_wasm_wheels, build_pure_python_wheels]
if: "startsWith(github.ref, 'refs/tags')"
steps:
- name: nothing
run: echo this is an empty job
upload_pypi:
name: upload wheels to pypi
runs-on: ubuntu-latest
needs: [release_trigger]
environment: release
permissions:
id-token: write
steps:
- name: download artifacts
uses: actions/download-artifact@v3
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: upload
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: artifact
create_release:
name: create github release
runs-on: ubuntu-latest
needs: [release_trigger]
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: recovery tag information
run: git fetch --tags --force
# See: https://github.com/actions/checkout/issues/290
- name: install emacs
run: sudo apt-get update && sudo apt-get install -y emacs
- name: export to markdown
run: emacs CHANGELOG.org --batch -f org-md-export-to-markdown --kill
- name: install setuptools_scm
run: python -m pip install setuptools_scm
- name: generate release description
run: python .github/scripts/generate_release_description.py
- name: download artifacts
uses: actions/download-artifact@v3
- name: release
uses: softprops/action-gh-release@v1
with:
files: |
artifact/*.whl
emscripten/*.whl
body_path: release_description.md