-
Notifications
You must be signed in to change notification settings - Fork 34
299 lines (289 loc) · 9.82 KB
/
build_and_upload.yaml
File metadata and controls
299 lines (289 loc) · 9.82 KB
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
name: Build&Upload
on:
workflow_dispatch:
release:
types: [published]
jobs:
build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install uv and set Python version
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
- name: Install dependencies
run: |
uv sync --locked --group build
- name: Build sdist
run: |
uv run python -m build --sdist --outdir ./dist
- uses: actions/upload-artifact@v4
with:
name: wheel-sdist
path: dist/*.tar.gz
retention-days: 30
compression-level: 0
build_wheels_linux_x86_64:
name: Build wheels linux x86_64
runs-on: ubuntu-latest
container: ${{matrix.container}}
strategy:
fail-fast: false
matrix:
include:
- artifact: wheel-linux_x86_64_python39
python: /opt/python/cp39-cp39/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
- artifact: wheel-linux_x86_64_python310
python: /opt/python/cp310-cp310/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
- artifact: wheel-linux_x86_64_python311
python: /opt/python/cp311-cp311/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
- artifact: wheel-linux_x86_64_python312
python: /opt/python/cp312-cp312/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
- artifact: wheel-linux_x86_64_python313
python: /opt/python/cp313-cp313/bin/python
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
steps:
- uses: actions/checkout@v5
- name: Get Python Version
shell: bash
run: |
set -eux
ls /opt/python
${{matrix.python}} --version > python_version.txt
cat python_version.txt
- name: Install Dependencies
shell: bash
run: |
set -eux
${{matrix.python}} -m pip install --upgrade pip
${{matrix.python}} -m pip install --upgrade build auditwheel
- 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=x86-64-v3 -mtune=generic'
export CXXFLAGS='-march=x86-64-v3 -mtune=generic'
export FFLAGS='-march=x86-64-v3 -mtune=generic'
${{matrix.python}} -m build --wheel --outdir ./dist
echo "::endgroup::"
- name: Show Files
id: wheel
shell: bash
run: |
set -x
source /opt/intel/oneapi/setvars.sh --force --config="/tmp/tmp/config.txt"
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@v4
with:
name: ${{matrix.artifact}}
path: ./wheelhouse/*.whl
retention-days: 30
compression-level: 0
build_wheels_linux_aarch64:
name: Build wheels linux aarch64 ${{matrix.CIBW_BUILD}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- artifact: wheel-linux_aarch64_python39
os: ubuntu-latest
arch: aarch64
CIBW_BUILD: cp39-manylinux_aarch64
- artifact: wheel-linux_aarch64_python310
os: ubuntu-latest
arch: aarch64
CIBW_BUILD: cp310-manylinux_aarch64
- artifact: wheel-linux_aarch64_python311
os: ubuntu-latest
arch: aarch64
CIBW_BUILD: cp311-manylinux_aarch64
- artifact: wheel-linux_aarch64_python312
os: ubuntu-latest
arch: aarch64
CIBW_BUILD: cp312-manylinux_aarch64
- artifact: wheel-linux_aarch64_python313
os: ubuntu-latest
arch: aarch64
CIBW_BUILD: cp313-manylinux_aarch64
steps:
- uses: actions/checkout@v5
- name: Set up QEME
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Build wheels on ${{matrix.arch}}
uses: pypa/cibuildwheel@v3.2.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<3' cmake ninja
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.14"
- uses: actions/upload-artifact@v4
with:
name: ${{matrix.artifact}}
path: ./wheelhouse/*.whl
retention-days: 30
compression-level: 0
build_wheels_macos_x86_64:
name: Build wheels macos x86_64
runs-on: macos-13
strategy:
fail-fast: false
matrix:
include:
- artifact: wheel-macosx-x86_64
MACOSX_DEPLOYMENT_TARGET: "13.0"
steps:
- uses: actions/checkout@v5
- name: Install Dependency
shell: bash
run: |
set -eux
brew install eigen nlohmann-json libomp
- name: Build wheels on macos x86_64
uses: pypa/cibuildwheel@v3.2.0
env:
CIBW_PLATFORM: macos
CIBW_ARCHS: x86_64
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.14"
CIBW_ENVIRONMENT: >
MACOSX_DEPLOYMENT_TARGET=${{ matrix.MACOSX_DEPLOYMENT_TARGET }}
- uses: actions/upload-artifact@v4
with:
name: ${{matrix.artifact}}
path: ./wheelhouse/*.whl
retention-days: 30
compression-level: 0
build_wheels_macos_arm64:
name: Build wheels macos arm64
runs-on: macos-14
strategy:
fail-fast: false
matrix:
include:
- artifact: wheel-macosx-arm64
MACOSX_DEPLOYMENT_TARGET: "14.0"
steps:
- uses: actions/checkout@v5
- name: Install Dependency
shell: bash
run: |
set -eux
brew install eigen nlohmann-json libomp
- name: Build wheels on macos arm64
uses: pypa/cibuildwheel@v3.2.0
env:
CIBW_PLATFORM: macos
CIBW_ARCHS: arm64
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.14"
CIBW_ENVIRONMENT: "MACOSX_DEPLOYMENT_TARGET=${{ matrix.MACOSX_DEPLOYMENT_TARGET }}"
- uses: actions/upload-artifact@v4
with:
name: ${{matrix.artifact}}
path: ./wheelhouse/*.whl
retention-days: 30
compression-level: 0
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: "CMAKE_TOOLCHAIN_FILE='C:/vcpkg/scripts/buildsystems/vcpkg.cmake'"
steps:
- uses: actions/checkout@v5
- name: Add msbuild to PATH
if: ${{ matrix.os == 'windows-latest'}}
uses: microsoft/setup-msbuild@v2.0.0
- name: Install Dependency
shell: powershell
run: |
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@v3.2.0
env:
CIBW_ENVIRONMENT: ${{ matrix.CIBW_ENVIRONMENT }}
CIBW_PLATFORM: ${{ matrix.CIBW_PLATFORM }}
CIBW_ARCHS: ${{matrix.arch}}
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.14"
- uses: actions/upload-artifact@v4
with:
name: wheel-windows
path: ./wheelhouse/*.whl
retention-days: 30
compression-level: 0
upload_pypi:
needs:
[
build_wheels_linux_x86_64,
build_wheels_linux_aarch64,
build_wheels_macos_x86_64,
build_wheels_macos_arm64,
build_wheels_windows,
build_sdist,
]
runs-on: ubuntu-latest
permissions:
id-token: write
if: ${{github.event_name == 'release'}}
steps:
- uses: actions/download-artifact@v5
with:
path: ./dist
pattern: wheel-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist
verify-metadata: true
skip-existing: false
verbose: true