-
Notifications
You must be signed in to change notification settings - Fork 4
388 lines (377 loc) · 14.2 KB
/
build_and_upload.yaml
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
name: Build&Upload
on:
workflow_dispatch:
release:
types: [published]
jobs:
build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install --upgrade pip wheel setuptools build
- name: Build sdist
run: |
python -m build --sdist --outdir ./dist
- uses: actions/upload-artifact@v3
with:
name: WHEEL
path: dist/*.tar.gz
retention-days: 30
build_wheels_linux_x86_64:
name: Build wheels linux x86_64
runs-on: ubuntu-latest
container: ${{matrix.container}}
strategy:
fail-fast: false
matrix:
include:
- python: /opt/python/cp38-cp38/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
- python: /opt/python/cp39-cp39/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
- python: /opt/python/cp310-cp310/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
- python: /opt/python/cp311-cp311/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
steps:
- uses: actions/checkout@v3
- name: Get Python Version
shell: bash
run: |
set -eux
ls /opt/python
${{matrix.python}} --version > python_version.txt
cat python_version.txt
- name: Pip-Tools
shell: bash
run: |
set -eux
${{matrix.python}} -m pip install pip-tools
${{matrix.python}} -m piptools compile setup.cfg
${{matrix.python}} -m piptools compile build-requirements.in
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
/var/cache/dnf/
key: ${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('build-requirements.txt') }}
restore-keys: |
${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('build-requirements.txt') }}
${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}
${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}
${{ runner.os }}-intel-
- name: Install Dependencies
shell: bash
run: |
set -eux
${{matrix.python}} -m piptools sync requirements.txt build-requirements.txt
- name: Build
run: |
set -x
echo "::group::Set Intel oneAPI"
mkdir -p /tmp/tmp
touch /tmp/tmp/config.txt
echo "" >> /tmp/tmp/config.txt
source /opt/intel/oneapi/compiler/latest/env/vars.sh
source /opt/intel/oneapi/mkl/latest/env/vars.sh
source /opt/intel/oneapi/setvars.sh --force --config="/tmp/tmp/config.txt"
du -a /opt/intel/oneapi/compiler/latest/linux/bin
echo "::endgroup::"
echo "::group::BUILD"
export CIBUILDWHEEL=1
export CC=icx
export CXX=icpx
export FC=ifx
export CFLAGS='-march=haswell -mtune=skylake'
export CXXFLAGS='-march=haswell -mtune=skylake'
export FFLAGS='-march=haswell -mtune=skylake'
${{matrix.python}} -m build --wheel --outdir ./dist
echo "::endgroup::"
#. /opt/intel/oneapi/setvars.sh --force --config="config.txt"
# export FC=ifx
- name: Show Files
id: wheel
shell: bash
run: |
set -x
source /opt/intel/oneapi/setvars.sh --force --config="/tmp/tmp/config.txt"
${{matrix.python}} -m auditwheel -h
${{matrix.python}} -m auditwheel show -h
${{matrix.python}} -m auditwheel repair -h
du -ah ./dist
cd dist
for f in *.whl; do ${{matrix.python}} -m auditwheel show $f; done
for f in *.whl; do ${{matrix.python}} -m auditwheel repair -w ../wheelhouse $f; done
cd ../wheelhouse
du -ah ./
- uses: actions/upload-artifact@v3
with:
name: WHEEL
path: ./wheelhouse/*.whl
retention-days: 30
build_wheels_linux_x86_64_old:
name: Build wheels linux x86_64 Old
runs-on: ubuntu-latest
container: ${{matrix.container}}
strategy:
fail-fast: false
matrix:
include:
- python: /opt/python/cp38-cp38/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux2014_x86_64:latest
- python: /opt/python/cp39-cp39/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux2014_x86_64:latest
steps:
- uses: actions/checkout@v3
- name: Get Python Version
shell: bash
run: |
set -eux
ls /opt/python
${{matrix.python}} --version > python_version.txt
cat python_version.txt
- name: Pip-Tools
shell: bash
run: |
set -eux
${{matrix.python}} -m pip install pip-tools
${{matrix.python}} -m piptools compile setup.cfg
${{matrix.python}} -m piptools compile build-requirements.in
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
/var/cache/yum/
key: ${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('build-requirements.txt') }}
restore-keys: |
${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('build-requirements.txt') }}
${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}
${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}
${{ runner.os }}-intel-
- name: Install Dependencies
shell: bash
run: |
set -eux
${{matrix.python}} -m piptools sync requirements.txt build-requirements.txt
- name: Build
run: |
set -x
echo "::group::Set Intel oneAPI"
mkdir -p /tmp/tmp
touch /tmp/tmp/config.txt
echo "" >> /tmp/tmp/config.txt
source /opt/intel/oneapi/compiler/latest/env/vars.sh
source /opt/intel/oneapi/mkl/latest/env/vars.sh
source /opt/intel/oneapi/setvars.sh --force --config="/tmp/tmp/config.txt"
du -a /opt/intel/oneapi/compiler/latest/linux/bin
echo "::endgroup::"
echo "::group::BUILD"
export CIBUILDWHEEL=1
export CC=icx
export CXX=icpx
export FC=ifx
export CFLAGS='-march=haswell -mtune=skylake'
export CXXFLAGS='-march=haswell -mtune=skylake'
export FFLAGS='-march=haswell -mtune=skylake'
${{matrix.python}} -m build --wheel --outdir ./dist
echo "::endgroup::"
#. /opt/intel/oneapi/setvars.sh --force --config="config.txt"
# export FC=ifx
- name: Show Files
id: wheel
shell: bash
run: |
set -x
source /opt/intel/oneapi/setvars.sh --force --config="/tmp/tmp/config.txt"
${{matrix.python}} -m auditwheel -h
${{matrix.python}} -m auditwheel show -h
${{matrix.python}} -m auditwheel repair -h
du -ah ./dist
cd dist
for f in *.whl; do ${{matrix.python}} -m auditwheel show $f; done
for f in *.whl; do ${{matrix.python}} -m auditwheel repair -w ../wheelhouse $f; done
cd ../wheelhouse
du -ah ./
- uses: actions/upload-artifact@v3
with:
name: WHEEL
path: ./wheelhouse/*.whl
retention-days: 30
build_wheels_linux_aarch64:
name: Build wheels linux aarch64 ${{matrix.CIBW_BUILD}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: aarch64
CIBW_BUILD: cp38-manylinux_aarch64
- os: ubuntu-latest
arch: aarch64
CIBW_BUILD: cp39-manylinux_aarch64
- os: ubuntu-latest
arch: aarch64
CIBW_BUILD: cp310-manylinux_aarch64
- os: ubuntu-latest
arch: aarch64
CIBW_BUILD: cp311-manylinux_aarch64
steps:
- uses: actions/checkout@v3
- name: Set up QEME
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Build wheels on ${{matrix.arch}}
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_BUILD: ${{matrix.CIBW_BUILD}}
CIBW_ENVIRONMENT: ""
CIBW_PLATFORM: linux
CIBW_ARCHS: ${{matrix.arch}}
CIBW_BEFORE_ALL_LINUX: >
dnf config-manager --set-enabled powertools &&
dnf makecache --refresh &&
dnf -y --enablerepo=powertools install openblas-static &&
dnf -y --enablerepo=powertools install lapack-static &&
dnf -y install gcc-toolset-11 &&
dnf -y --enablerepo=powertools install eigen3-devel
CIBW_BEFORE_BUILD_LINUX: >
source scl_source enable gcc-toolset-11 &&
pip install pybind11 cmake ninja
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
- uses: actions/upload-artifact@v3
with:
name: WHEEL
path: ./wheelhouse/*.whl
retention-days: 30
build_wheels_macos:
name: Build wheels macos ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
arch: x86_64
CIBW_PLATFORM: macos
CIBW_ENVIRONMENT: "MACOSX_DEPLOYMENT_TARGET='12.0'"
- os: macos-latest
arch: x86_64
CIBW_PLATFORM: macos
CIBW_ENVIRONMENT: "MACOSX_DEPLOYMENT_TARGET='11.0' CFLAGS='-mtune=skylake' CXXFLAGS='-mtune=skylake'"
- os: macos-latest
arch: x86_64
CIBW_PLATFORM: macos
CIBW_ENVIRONMENT: "MACOSX_DEPLOYMENT_TARGET='10.16' CFLAGS='-mtune=skylake' CXXFLAGS='-mtune=skylake'"
- os: macos-latest
arch: arm64
CIBW_PLATFORM: macos
CIBW_ENVIRONMENT: "MACOSX_DEPLOYMENT_TARGET='12.0'"
- os: macos-latest
arch: arm64
CIBW_PLATFORM: macos
CIBW_ENVIRONMENT: "MACOSX_DEPLOYMENT_TARGET='11.0'"
steps:
- uses: actions/checkout@v3
- name: Install Dependency
shell: bash
run: |
set -eux
brew install eigen nlohmann-json
- name: Build wheels on ${{ matrix.CIBW_PLATFORM }} ${{matrix.arch}}
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ENVIRONMENT: ${{ matrix.CIBW_ENVIRONMENT }}
CIBW_PLATFORM: ${{ matrix.CIBW_PLATFORM }}
CIBW_ARCHS: ${{matrix.arch}}
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
- uses: actions/upload-artifact@v3
with:
name: WHEEL
path: ./wheelhouse/*.whl
retention-days: 30
build_wheels_windows:
name: Build wheels windows ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
arch: AMD64
CIBW_PLATFORM: windows
CIBW_ENVIRONMENT: "CFLAGS='-march=haswell -mtune=skylake' CXXFLAGS='-march=haswell -mtune=skylake' CMAKE_TOOLCHAIN_FILE='C:/vcpkg/scripts/buildsystems/vcpkg.cmake'"
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
if: ${{ matrix.os == 'windows-latest'}}
uses: microsoft/setup-msbuild@v1.3.1
- name: Prepare Cache
if: ${{ matrix.os == 'windows-latest'}}
shell: bash
run: |
set -eux
ls C:/vcpkg
MSBuild.exe -version > msbuild_version.txt
cat msbuild_version.txt
- name: Cache vcpkg
uses: actions/cache@v3
if: ${{ matrix.os == 'windows-latest'}}
with:
path: |
C:/Users/runneradmin/AppData/Local/vcpkg/archives
key: ${{ matrix.os }}-vcpkg-${{ hashFiles('msbuild_version.txt') }}
restore-keys: |
${{ matrix.os }}-vcpkg-${{ hashFiles('msbuild_version.txt') }}
${{ matrix.os }}-vcpkg
- name: Install Dependency
shell: bash
run: |
set -eux
vcpkg update
vcpkg --triplet x64-windows-static install eigen3
vcpkg --triplet x64-windows install eigen3
vcpkg --triplet x64-windows-static install nlohmann-json
vcpkg --triplet x64-windows install nlohmann-json
vcpkg integrate install
- name: Build wheels on ${{ matrix.CIBW_PLATFORM }} ${{matrix.arch}}
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ENVIRONMENT: ${{ matrix.CIBW_ENVIRONMENT }}
CIBW_PLATFORM: ${{ matrix.CIBW_PLATFORM }}
CIBW_ARCHS: ${{matrix.arch}}
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
- uses: actions/upload-artifact@v3
with:
name: WHEEL
path: ./wheelhouse/*.whl
retention-days: 30
upload_pypi:
needs: [build_wheels_linux_x86_64, build_wheels_linux_x86_64_old, build_wheels_linux_aarch64, build_wheels_macos, build_wheels_windows, build_sdist]
runs-on: ubuntu-latest
if: ${{github.event_name == 'release'}}
steps:
- uses: actions/download-artifact@v3
with:
name: WHEEL
path: ./dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
packages_dir: ./dist
verify_metadata: true
skip_existing: false
verbose: true