1
1
name : build and upload wheels
2
2
3
+ # Currently we aim to test building python wheels for all pushes to feature and release branches
4
+ # HOWEVER we only want to upload these wheels to testpypi for release candidates, which are considered
5
+ # to be pushes to a release branch or to develop.
6
+ # finally, we only push tagged releases to pypi proper. Note that only a subset of platforms are considered
7
+ # for test builds and the full suite (including longer-running builds) is only run on pushes to tags.
8
+ # This is controlled using conditional statements for individual jobs and steps in this script.
3
9
on :
4
10
push :
5
11
tags :
6
12
- ' *'
13
+ branches :
14
+ - release/*
15
+ - feature/*
16
+ - main
17
+ - develop
7
18
8
19
jobs :
9
20
build_wheels :
10
- name : build wheels on ${{matrix.build-platform[0]}} ${{matrix.build-platform[1]}}
21
+ name : build ${{matrix.build-platform[2]}} wheels on ${{matrix.build-platform[0]}} ${{matrix.build-platform[1]}}
11
22
runs-on : ${{matrix.build-platform[0]}}
12
23
strategy :
13
24
fail-fast : false
14
25
matrix :
15
26
build-platform :
27
+ # ubuntu/aarch64 emulation and manylinux2014 are both slow running builds
28
+ # which are only executed on push to tag.
29
+ # Test wheels are also generated for the other platforms (and uploaded to testpypi)
30
+ # on pushes to release branches and to main
16
31
- [ubuntu-latest, x86_64, manylinux2014_x86_64]
17
32
- [ubuntu-latest, x86_64, manylinux_2_28_x86_64]
18
- - [ubuntu-latest,aarch64,manylinux_2_28_aarch64]
33
+ - [ubuntu-latest, aarch64, manylinux_2_28_aarch64]
19
34
- [macos-13, x86_64, macosx_x86_64]
20
35
- [macos-14, arm64, macosx_arm64]
36
+ - [windows-latest, AMD64, win_amd64]
21
37
22
38
steps :
23
39
- uses : actions/checkout@v3
24
- # need git tags available for setuptools_scm to grab tags? will elad to slower checkout
40
+ # need git tags available for setuptools_scm to grab tags
25
41
with :
26
42
fetch-depth : 0
27
43
44
+ - uses : actions/github-script@v6
45
+ with :
46
+ script : |
47
+ core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
48
+ core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
49
+
28
50
- name : Set up QEMU
29
51
if : runner.os == 'Linux'
30
52
uses : docker/setup-qemu-action@v3
31
53
with :
32
54
platforms : all
33
55
56
+ - name : install windows deps
57
+ if : runner.os == 'Windows'
58
+ run : >
59
+ vcpkg install --triplet x64-windows-static-md --binarysource="clear;x-gha,readwrite"
60
+ libxml2
61
+ capnproto
62
+ boost-program-options
63
+ boost-format
64
+ boost-algorithm
65
+ boost-multi-array
66
+ openssl
67
+ dlfcn-win32
68
+ spdlog
69
+
70
+ - name : build uda on windows
71
+ if : runner.os == 'Windows'
72
+ env :
73
+ XDR_ROOT : extlib/install
74
+ CMAKE_PREFIX_PATH : C:/vcpkg/installed/x64-windows-static-md
75
+ Boost_DIR : C:/vcpkg/installed/x64-windows-static-md/share/boost
76
+ LibXml2_DIR : C:/vcpkg/installed/x64-windows-static-md/share/libxml2
77
+ CapnProto_DIR : C:/vcpkg/installed/x64-windows-static-md/share/capnproto
78
+ fmt_DIR : C:/vcpkg/installed/x64-windows-static-md/share/fmt
79
+ run : >
80
+ cmake -Bextlib/build ./extlib
81
+ -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
82
+ -DVCPKG_TARGET_TRIPLET="x64-windows-static-md"
83
+ -DVCPKG_HOST_TRIPLET="x64-windows-static-md"
84
+ -DCMAKE_GENERATOR_PLATFORM=x64
85
+ -DBUILD_SHARED_LIBS=OFF
86
+ && cmake --build extlib/build --config Release
87
+ && cmake --install extlib/build --prefix extlib/install
88
+ && cmake -Bbuild .
89
+ -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
90
+ -DVCPKG_TARGET_TRIPLET="x64-windows-static-md"
91
+ -DVCPKG_HOST_TRIPLET="x64-windows-static-md"
92
+ -DCMAKE_GENERATOR_PLATFORM=x64
93
+ -DBUILD_SHARED_LIBS=ON
94
+ -DSSLAUTHENTICATION=ON
95
+ -DCLIENT_ONLY=ON
96
+ -DENABLE_CAPNP=ON
97
+ -DNO_JAVA_WRAPPER=ON
98
+ -DNO_CXX_WRAPPER=ON
99
+ -DNO_IDL_WRAPPER=ON
100
+ -DNO_CLI=ON
101
+ -DNO_MEMCACHE=ON
102
+ -DCMAKE_INSTALL_PREFIX=install
103
+ && cmake --build build -j --config Release
104
+ && cmake --install build --config Release
105
+ && ls install/lib
106
+ && cat install/python_installer/setup.py
107
+
108
+ - name : build windows wheels
109
+ if : runner.OS == 'Windows'
110
+
111
+ with :
112
+ package-dir : ${{github.workspace}}/install/python_installer
113
+ config-file : ${{github.workspace}}/install/python_installer/pyproject.toml
114
+ env :
115
+ CIBW_ARCHS : ${{matrix.build-platform[1]}}
116
+ CIBW_PLATFORM : windows
117
+ CIBW_BUILD : cp3*-${{matrix.build-platform[2]}}
118
+ CIBW_SKIP : cp36* cp37*
119
+ CIBW_REPAIR_WHEEL_COMMAND_WINDOWS : " delvewheel repair -w {dest_dir} {wheel} --add-path ${{github.workspace}}/install/lib"
120
+ CIBW_BEFORE_BUILD_WINDOWS : " pip install delvewheel"
121
+
34
122
- name : Build manylinux2014 wheels
35
- if : startswith(matrix.build-platform[2], 'manylinux2014')
123
+ # this is a slow-running build. Only execute on tag
124
+ if : >
125
+ startswith(matrix.build-platform[2], 'manylinux2014') &&
126
+ github.event_name == 'push' &&
127
+ startsWith(github.ref, 'refs/tags/')
36
128
37
129
with :
38
130
package-dir : ./source/wrappers/python
@@ -79,7 +171,11 @@ jobs:
79
171
cp -r /usr/local/python_installer/* /project/source/wrappers/python/
80
172
81
173
- name : Build manylinux_2_28 wheels
82
- if : startswith(matrix.build-platform[2], 'manylinux_2_28')
174
+ # hardware emulation for ubuntu on arm64 archiecture is much slower. Do not run that case except for push to tag.
175
+ if : >
176
+ startswith(matrix.build-platform[2], 'manylinux_2_28') &&
177
+ ! ( startswith(matrix.build-platform[1], 'aarch64') &&
178
+ !startsWith(github.ref, 'refs/tags/') )
83
179
84
180
with :
85
181
package-dir : ./source/wrappers/python
@@ -145,6 +241,8 @@ jobs:
145
241
path : ./wheelhouse/*.whl
146
242
147
243
upload_pypi :
244
+ # only upload to pypi for tagged releases
245
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
148
246
needs : build_wheels
149
247
runs-on : ubuntu-latest
150
248
environment :
@@ -161,3 +259,26 @@ jobs:
161
259
merge-multiple : true
162
260
163
261
- uses : pypa/gh-action-pypi-publish@release/v1
262
+
263
+ upload_test_pypi :
264
+ # push test wheels to testpypi for all intermediate release candidates (release/*, develop, etc.)
265
+ # but never for feature branches
266
+ if : >
267
+ github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/feature/')
268
+ needs : build_wheels
269
+ runs-on : ubuntu-latest
270
+ environment :
271
+ name : testpypi
272
+ permissions :
273
+ id-token : write
274
+ steps :
275
+ - uses : actions/download-artifact@v4
276
+ with :
277
+ # unpacks all CIBW artifacts into dist/
278
+ pattern : cibw-*
279
+ path : dist
280
+ merge-multiple : true
281
+
282
+ - uses : pypa/gh-action-pypi-publish@release/v1
283
+ with :
284
+ repository-url : https://test.pypi.org/legacy/
0 commit comments