-
Notifications
You must be signed in to change notification settings - Fork 1
306 lines (279 loc) · 10.1 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
name: build
on: [push, pull_request]
jobs:
test_TAT_hpp:
name: test TAT.hpp
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
steps:
- name: checkout
uses: actions/checkout@v3
- name: install mpi, openblas and gtest/gmock
run: 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}}
- 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
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
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 --cov=lazy --cov-fail-under=100
build_wheels_trigger:
name: trigger for building wheels
runs-on: ubuntu-latest
needs: [test_TAT_hpp, test_lazy_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: tetraux
- package: PyScalapack
steps:
- name: checkout
uses: actions/checkout@v3
- name: install emacs
run: 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_wheels:
name: build PyTAT wheels
runs-on: ${{ matrix.os }}
needs: [build_wheels_trigger, generate_python_markdown_readme]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python: 38
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
cpu_number: 2
- os: ubuntu-latest
python: 39
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
cpu_number: 2
- os: ubuntu-latest
python: 310
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
cpu_number: 2
- os: ubuntu-latest
python: 311
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
cpu_number: 2
- os: macos-latest
python: 310
platform_id: macosx_x86_64
mac_arch: x86_64
cpu_number: 3
- os: macos-latest
python: 311
platform_id: macosx_x86_64
mac_arch: x86_64
cpu_number: 3
- os: macos-latest
python: 310
platform_id: macosx_arm64
mac_arch: arm64
cpu_number: 3
- os: macos-latest
python: 311
platform_id: macosx_arm64
mac_arch: arm64
cpu_number: 3
- os: windows-latest
python: 38
platform_id: win_amd64
cpu_number: 2
- os: windows-latest
python: 39
platform_id: win_amd64
cpu_number: 2
- os: windows-latest
python: 310
platform_id: win_amd64
cpu_number: 2
- os: windows-latest
python: 311
platform_id: win_amd64
cpu_number: 2
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: recovery tag information
run: git fetch --tags --force
- name: get pybind11
uses: actions/checkout@v3
with:
repository: pybind/pybind11
path: pybind11
- 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: download artifacts for tetraux
uses: actions/download-artifact@v3
with:
name: README-of-tetraux
path: tetraux
- name: build wheel for PyTAT
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_ARCHS: all
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_BEFORE_ALL_LINUX: yum install -y openblas-devel
CIBW_BEFORE_ALL_WINDOWS: cmd /c python .github\scripts\get_openblas_for_windows.py && choco install -y ninja
CIBW_BEFORE_ALL_MACOS: ""
CIBW_ENVIRONMENT_LINUX: MAKEFLAGS=--parallel=${{ matrix.cpu_number }}
CIBW_ENVIRONMENT_WINDOWS: MAKEFLAGS=--parallel=${{ matrix.cpu_number }} CMAKEFLAGS="-GNinja|-DCMAKE_CXX_COMPILER=clang++|-DTAT_MATH_LIBRARIES=../../../../lib/libopenblas"
CIBW_ENVIRONMENT_MACOS: MAKEFLAGS=--parallel=${{ matrix.cpu_number }} CMAKEFLAGS="-DCMAKE_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
run: python -m cibuildwheel PyTAT --output-dir dist
- name: build wheel for tetraux
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_ARCHS: all
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_BEFORE_ALL_LINUX: yum install -y openblas-devel
CIBW_BEFORE_ALL_WINDOWS: cmd /c python .github\scripts\get_openblas_for_windows.py && choco install -y ninja
CIBW_BEFORE_ALL_MACOS: ""
CIBW_ENVIRONMENT_LINUX: MAKEFLAGS=--parallel=${{ matrix.cpu_number }}
CIBW_ENVIRONMENT_WINDOWS: MAKEFLAGS=--parallel=${{ matrix.cpu_number }} CMAKEFLAGS="-GNinja|-DCMAKE_CXX_COMPILER=clang++|-DTAT_MATH_LIBRARIES=../../../../lib/libopenblas"
CIBW_ENVIRONMENT_MACOS: MAKEFLAGS=--parallel=${{ matrix.cpu_number }} CMAKEFLAGS="-DCMAKE_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
run: python -m cibuildwheel tetraux --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
- 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
upload_pypi:
name: upload wheels to pypi
runs-on: ubuntu-latest
needs: [build_wheels_trigger, build_pytat_wheels, build_pure_python_wheels]
if: startsWith(github.ref, 'refs/tags')
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:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: artifact
create_release:
name: create github release
runs-on: ubuntu-latest
needs: [build_wheels_trigger, build_pytat_wheels, build_pure_python_wheels]
if: startsWith(github.ref, 'refs/tags')
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: recovery tag information
run: git fetch --tags --force
- name: install emacs
run: sudo apt-get install -y emacs
- name: export to markdown
run: emacs CHANGELOG.org --batch -f org-md-export-to-markdown --kill
- 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
body_path: release_description.md