1
+ name : Python
2
+
3
+ on :
4
+ push :
5
+ branches : [ master, python, experiments, stateful-c-lib ]
6
+ tags : [ v* ]
7
+
8
+ jobs :
9
+ python-sdist :
10
+ name : python sdist
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - uses : actions/checkout@v3
14
+ - run : git submodule update --init extlib/mimalloc extlib/eigen
15
+ - uses : actions/setup-python@v3
16
+ with :
17
+ python-version : " 3.10"
18
+ - name : Pack
19
+ shell : bash
20
+ run : |
21
+ if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
22
+ version="${GITHUB_REF##*/}"
23
+ else
24
+ mkdir empty-build
25
+ cd empty-build
26
+ cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
27
+ source version.env
28
+ cd ..
29
+ version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}"
30
+ fi
31
+ sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
32
+ python -m pip install -U setuptools build
33
+ python -m build --sdist
34
+ - name : Upload artifact
35
+ uses : actions/upload-artifact@v3
36
+ with :
37
+ name : sdist
38
+ path : dist/*.tar.gz
39
+ python-wheel :
40
+ name : ${{ matrix.os_short }} python ${{ matrix.architecture }} cp${{ matrix.python_version }}
41
+ runs-on : ${{ matrix.os }}
42
+ timeout-minutes : 240
43
+ strategy :
44
+ fail-fast : false
45
+ matrix :
46
+ os_arch : [
47
+ " windows-ia32" ,
48
+ " windows-x64" ,
49
+ # "windows-arm64",
50
+ " macos-x86_64" ,
51
+ " macos-arm64" ,
52
+ " linux-x86_64" ,
53
+ " linux-aarch64" ,
54
+ ]
55
+ python_version : [
56
+ " 37" ,
57
+ " 38" ,
58
+ " 39" ,
59
+ " 310" ,
60
+ " 311" ,
61
+ ]
62
+ exclude :
63
+ - os_arch : " macos-arm64"
64
+ python_version : " 37"
65
+ include :
66
+ - os_arch : " windows-ia32"
67
+ os : " windows-2022"
68
+ os_short : " windows"
69
+ architecture : " ia32"
70
+ cibuildwheel_architecture : " x86"
71
+ cmake_generator_platform : " Win32"
72
+ - os_arch : " windows-x64"
73
+ os : " windows-2022"
74
+ os_short : " windows"
75
+ architecture : " x64"
76
+ cibuildwheel_architecture : " AMD64"
77
+ cmake_generator_platform : " x64"
78
+ # - os_arch: "windows-arm64"
79
+ # os: "windows-2022"
80
+ # os_short: "windows"
81
+ # architecture: "arm64"
82
+ # cibuildwheel_architecture: "ARM64"
83
+ # cmake_generator_platform: "ARM64"
84
+ - os_arch : " macos-x86_64"
85
+ os : " macos-11.0"
86
+ os_short : " macos"
87
+ cibuildwheel_architecture : " x86_64"
88
+ architecture : " x86_64"
89
+ - os_arch : " macos-arm64"
90
+ os : " macos-11.0"
91
+ os_short : " macos"
92
+ cibuildwheel_architecture : " arm64"
93
+ architecture : " arm64"
94
+ - os_arch : linux-x86_64
95
+ os : " ubuntu-22.04"
96
+ os_short : " linux"
97
+ cibuildwheel_architecture : " x86_64"
98
+ architecture : " x86_64"
99
+ - os_arch : linux-aarch64
100
+ os : " ubuntu-22.04"
101
+ os_short : " linux"
102
+ cibuildwheel_architecture : " aarch64"
103
+ architecture : " aarch64"
104
+ steps :
105
+ - uses : actions/checkout@v3
106
+ with :
107
+ fetch-depth : 0
108
+ - run : git submodule update --init extlib/mimalloc extlib/eigen
109
+ - name : Set version
110
+ shell : bash
111
+ run : |
112
+ if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
113
+ version="${GITHUB_REF##*/}"
114
+ else
115
+ mkdir empty-build
116
+ cd empty-build
117
+ cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
118
+ source version.env
119
+ cd ..
120
+ version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}"
121
+ fi
122
+ sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
123
+ - name : Set up QEMU
124
+ uses : docker/setup-qemu-action@v2
125
+ if : matrix.architecture == 'aarch64'
126
+ with :
127
+ platforms : arm64
128
+ - name : Build wheels
129
+ uses : pypa/cibuildwheel@v2.11.2
130
+ env :
131
+ CIBW_BUILD : " cp${{ matrix.python_version }}-*"
132
+ CIBW_PLATFORM : " ${{ matrix.os_short }}"
133
+ CIBW_BUILD_VERBOSITY : " 1"
134
+ CIBW_ARCHS : " ${{ matrix.cibuildwheel_architecture }}"
135
+ CIBW_ENVIRONMENT_WINDOWS : >
136
+ CMAKE_GENERATOR="Visual Studio 17 2022"
137
+ CMAKE_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}"
138
+ CIBW_ENVIRONMENT_PASS_WINDOWS : " CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM"
139
+ - uses : actions/upload-artifact@v3
140
+ with :
141
+ name : wheel-${{ matrix.os_short }}-${{ matrix.architecture }}
142
+ path : |
143
+ ./wheelhouse/*.whl
144
+ publish-pypi :
145
+ name : publish to PyPi
146
+ needs : [
147
+ python-sdist,
148
+ python-wheel,
149
+ ]
150
+ runs-on : ubuntu-22.04
151
+ steps :
152
+ - uses : actions/download-artifact@v3
153
+ with :
154
+ path : prebuilds
155
+ - name : prepare
156
+ shell : bash
157
+ run : |
158
+ mkdir dist
159
+ ls prebuilds
160
+ mv prebuilds/*/* dist
161
+ ls dist
162
+ - name : Publish wheels to Test PyPI
163
+ uses : pypa/gh-action-pypi-publish@release/v1
164
+ with :
165
+ password : ${{ secrets.TEST_PYPI_API_TOKEN }}
166
+ repository_url : https://test.pypi.org/legacy/
167
+ - name : Publish wheels to PyPI
168
+ if : startsWith(github.ref, 'refs/tags')
169
+ uses : pypa/gh-action-pypi-publish@release/v1
170
+ with :
171
+ password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments