forked from ukaea/UDA
-
Notifications
You must be signed in to change notification settings - Fork 0
281 lines (258 loc) · 11.5 KB
/
build_wheels.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
name: build and upload wheels
on:
push:
branches:
- feature/python-wheels
- feature/python-wheels-windows
jobs:
build_wheels:
# name: build wheels on ${{matrix.os}} ${{matrix.arch}}
name: build wheels on ${{matrix.build-platform[0]}} ${{matrix.build-platform[1]}}
# runs-on: ${{matrix.os}}
runs-on: ${{matrix.build-platform[0]}}
strategy:
fail-fast: false
matrix:
build-platform:
## - [ubuntu-latest, x86_64, manylinux2014_x86_64]
#- [ubuntu-latest, x86_64, manylinux_2_28_x86_64]
## - [ubuntu-latest,aarch64,manylinux_2_28_aarch64]
#- [macos-13, x86_64, macosx_x86_64]
#- [macos-14, arm64, macosx_arm64]
- [windows-latest, AMD64, win_amd64]
# python:
# ["cp36", "cp37", "cp38", "cp39", "cp310", "cp311"]
steps:
- uses: actions/checkout@v3
# need git tags available for setuptools_scm to grab tags? will lead to slower checkout
with:
fetch-depth: 0
- uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: install windows deps
if: runner.os == 'Windows'
run: >
vcpkg install --triplet x64-windows-static-md --binarysource="clear;x-gha,readwrite"
libxml2
capnproto
boost-program-options
boost-format
boost-algorithm
boost-multi-array
openssl
dlfcn-win32
spdlog
- name: build uda on windows
if: runner.os == 'Windows'
env:
XDR_ROOT: extlib/install
CMAKE_PREFIX_PATH: C:/vcpkg/installed/x64-windows-static-md
Boost_DIR: C:/vcpkg/installed/x64-windows-static-md/share/boost
LibXml2_DIR: C:/vcpkg/installed/x64-windows-static-md/share/libxml2
CapnProto_DIR: C:/vcpkg/installed/x64-windows-static-md/share/capnproto
fmt_DIR: C:/vcpkg/installed/x64-windows-static-md/share/fmt
run: >
cmake -Bextlib/build ./extlib
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET="x64-windows-static-md"
-DVCPKG_HOST_TRIPLET="x64-windows-static-md"
-DCMAKE_GENERATOR_PLATFORM=x64
-DBUILD_SHARED_LIBS=OFF
&& cmake --build extlib/build --config Release
&& cmake --install extlib/build --prefix extlib/install
&& cmake -Bbuild .
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET="x64-windows-static-md"
-DVCPKG_HOST_TRIPLET="x64-windows-static-md"
-DCMAKE_GENERATOR_PLATFORM=x64
-DBUILD_SHARED_LIBS=ON
-DSSLAUTHENTICATION=OFF
-DCLIENT_ONLY=ON
-DENABLE_CAPNP=ON
-DNO_JAVA_WRAPPER=ON
-DNO_CXX_WRAPPER=ON
-DNO_IDL_WRAPPER=ON
-DNO_CLI=ON
-DNO_MEMCACHE=ON
-DCMAKE_INSTALL_PREFIX=install
&& cmake --build build -j --config Release
&& cmake --install build --config Release
&& ls install/lib
# && cp -r install ${{github.workspace}}\python_installer
# && ls ${{github.workspace}}
# && sed -i "s/.*Iconv_INCLUDE_DIR.*/Iconv_INCLUDE_DIR:PATH=C:/vcpkg/installed/x64-windows-static-md/include" build/CMakeCache.txt
# && (Get-Content build/CMakeCache.txt) | ForEach-Object {
# if ($_ -match ".*Iconv_INCLUDE_DIR.*") {
# "Iconv_INCLUDE_DIR:PATH=C:/vcpkg/installed/x64-windows-static-md/include"
# } else {
# $_
# }
# } | Set-Content ./build/CMakeCache.txt
# && Add-Content -Path ./build/CMakeCache.txt -Value "Iconv_INCLUDE_DIR:PATH=C:/vcpkg/installed/x64-windows-static-md/include"
# && cp C:/vcpkg/installed/x64-windows-static-md/include/iconv.h C:/vcpkg/installed/x64-windows-static-md/include/libxml2/libxml/
# && cp C:/vcpkg/installed/x64-windows-static-md/include/iconv.h ./source/structures/
# - name: test pyuda on windows
# if: runner.os == 'Windows'
# env:
# UDA_DIR: ${{github.workspace}}\install
# EXTLIB_INSTALL_DIR: ${{github.workspace}}\extlib\install
# run: >
# (gcm python3).Path &&
# #Set-Content -Path "C:\hostedtoolcache\windows\Python\3.9.13\x64\Lib\distutils\distutils.cfg" -Value "[build]`ncompiler = mingw32" &&
# python3 -m venv ${{github.workspace}}/venv &&
# ls ${{github.workspace}}/venv &&
# ${{github.workspace}}/venv/Scripts/Activate.ps1 &&
# pip3 install --upgrade pip wheel &&
# pip3 install Cython numpy six wheel &&
# CXX=g++ CC=gcc python3 ${{github.workspace}}\install\python_installer\setup.py bdist_wheel
#
- name: build windows wheels
if: runner.OS == 'Windows'
uses: pypa/cibuildwheel@v2.17.0
with:
package-dir: ${{github.workspace}}/install/python_installer
config-file: ${{github.workspace}}/install/python_installer/pyproject.toml
env:
CIBW_ARCHS: ${{matrix.build-platform[1]}}
CIBW_PLATFORM: windows
CIBW_BUILD: cp*-${{matrix.build-platform[2]}}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel} --add-path ${{github.workspace}}/install/lib"
- name: Build manylinux2014 wheels
if: startswith(matrix.build-platform[2], 'manylinux2014')
uses: pypa/cibuildwheel@v2.17.0
with:
package-dir: ./source/wrappers/python
config-file: ./source/wrappers/python/pyproject.toml
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
CIBW_ARCHS: ${{matrix.build-platform[1]}}
CIBW_BUILD: cp*-manylinux*
CIBW_SKIP: cp34* *-musllinux*
CIBW_BEFORE_ALL: >
yum update -y &&
yum install -y wget openssl-devel libxml2-devel libtirpc-devel &&
cd /tmp &&
wget https://github.com/fmtlib/fmt/archive/refs/tags/10.0.0.tar.gz &&
tar xzf 10.0.0.tar.gz &&
cd fmt-10.0.0 &&
cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON &&
cmake --build build -j --config Release --target install &&
cd /tmp &&
wget https://github.com/gabime/spdlog/archive/refs/tags/v1.11.0.tar.gz &&
tar xzf v1.11.0.tar.gz &&
cd spdlog-1.11.0 &&
cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON &&
cmake --build build -j --config Release --target install &&
cd /tmp &&
wget https://github.com/capnproto/capnproto/archive/refs/tags/v0.10.4.tar.gz &&
tar xzf v0.10.4.tar.gz &&
cd capnproto-0.10.4 &&
cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON &&
cmake --build build &&
cmake --install build &&
cd /tmp &&
wget https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz &&
tar xzf boost_1_80_0.tar.gz &&
cd boost_1_80_0 &&
./bootstrap.sh --prefix=/usr/local &&
./b2 --without-python --prefix=/usr/local install &&
cd /project &&
cmake -B build -DNO_JAVA_WRAPPER=ON -DBUILD_SHARED_LIBS=ON -DSSLAUTHENTICATION=OFF -DENABLE_CAPNP=ON -DCLIENT_ONLY=ON &&
cmake --build build -j --config Release --target install &&
cp -r /usr/local/python_installer/* /project/source/wrappers/python/
- name: Build manylinux_2_28 wheels
if: startswith(matrix.build-platform[2], 'manylinux_2_28')
uses: pypa/cibuildwheel@v2.17.0
with:
# package-dir: /usr/local/python_installer
package-dir: ./source/wrappers/python
config-file: ./source/wrappers/python/pyproject.toml
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_ARCHS: ${{matrix.build-platform[1]}}
CIBW_BUILD: cp*-manylinux*
CIBW_SKIP: cp34* *-musllinux*
CIBW_BEFORE_ALL: >
dnf update -y &&
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm &&
dnf install -y boost-devel openssl-devel libxml2-devel libtirpc-devel
fmt fmt-devel spdlog spdlog-devel capnproto capnproto-devel &&
cd /project &&
cmake -B build
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Release
-DSSLAUTHENTICATION=OFF
-DNO_JAVA_WRAPPER=ON
-DENABLE_CAPNP=ON -DCLIENT_ONLY=ON &&
cmake --build build -j --config Release --target install &&
cp -r /usr/local/python_installer/* /project/source/wrappers/python/
- name: build uda on macos
if: runner.os == 'macOS'
run: >
brew update-reset && brew install
git
boost
openssl
cmake
libxml2
spdlog
capnp &&
cd ${{github.workspace}} &&
cmake -B build
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Release
-DSSLAUTHENTICATION=OFF
-DENABLE_CAPNP=ON
-DNO_JAVA_WRAPPER=ON
-DCMAKE_INSTALL_PREFIX=$PWD/install
-DCLIENT_ONLY=ON &&
cmake --build build -j --config Release --target install &&
cp -r $PWD/install/python_installer/* ${{github.workspace}}/source/wrappers/python/
- name: Build macos wheels
if: runner.os == 'macOS'
uses: pypa/cibuildwheel@v2.17.0
with:
package-dir: ./source/wrappers/python
config-file: ./source/wrappers/python/pyproject.toml
env:
CIBW_ARCHS: ${{matrix.build-platform[1]}}
CIBW_PLATFORM: macos
CIBW_BUILD: cp*-${{matrix.build-platform[2]}}
#CIBW_SKIP: cp36* cp37*
# CIBW_BEFORE_ALL:
# cat ./source/wrappers/python/setup.py
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
# upload_pypi:
# needs: build_wheels
# runs-on: ubuntu-latest
# environment:
# name: testpypi
# # url: https://test.pypi.org/project/ukaea_pyuda/
# permissions:
# id-token: write
# # if: github.event_name == 'release' && github.event.action == 'published'
# # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# steps:
# - uses: actions/download-artifact@v4
# with:
# # unpacks all CIBW artifacts into dist/
# pattern: cibw-*
# path: dist
# merge-multiple: true
#
# - uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/