-
Notifications
You must be signed in to change notification settings - Fork 164
222 lines (195 loc) · 7.73 KB
/
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
name: build_wheels
on:
schedule:
- cron: "0 5 * * *"
release:
types: [created]
workflow_dispatch:
jobs:
build_wheels:
name: Build wheel for cp${{ matrix.cibw_python }}-${{ matrix.platform_id }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Have to specify python version twice so that the same python is used to build and test
# Need to quote decimal versions as string to avoid the "Norway problem"
# Windows 64-bit
- os: windows-latest
python: '3.9'
cibw_python: 39
platform_id: win_amd64
- os: windows-latest
python: '3.10'
cibw_python: 310
platform_id: win_amd64
- os: windows-latest
python: '3.11'
cibw_python: 311
platform_id: win_amd64
- os: windows-latest
python: '3.12'
cibw_python: 312
platform_id: win_amd64
# Linux 64-bit
- os: ubuntu-latest
python: '3.8'
cibw_python: 38
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: '3.9'
cibw_python: 39
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: '3.10'
cibw_python: 310
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: '3.11'
cibw_python: 311
platform_id: manylinux_x86_64
- os: ubuntu-latest
python: '3.12'
cibw_python: 312
platform_id: manylinux_x86_64
# macOS on Intel 64-bit
- os: macos-12
python: '3.9'
cibw_python: 39
arch: x86_64
platform_id: macosx_x86_64
- os: macos-12
python: '3.10'
cibw_python: 310
arch: x86_64
platform_id: macosx_x86_64
- os: macos-12
python: '3.11'
cibw_python: 311
arch: x86_64
platform_id: macosx_x86_64
- os: macos-12
python: '3.12'
cibw_python: 312
arch: x86_64
platform_id: macosx_x86_64
# macOS on Apple M1 64-bit, supported for Python 3.10 and later
- os: macos-14
python: '3.10'
cibw_python: 310
arch: arm64
platform_id: macosx_arm64
- os: macos-14
python: '3.11'
cibw_python: 311
arch: arm64
platform_id: macosx_arm64
- os: macos-14
python: '3.12'
cibw_python: 312
arch: arm64
platform_id: macosx_arm64
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
name: Install Python host for cibuildwheel
with:
python-version: ${{ matrix.python }}
# Visual Studio
- name: Set up MSVC x64
if: matrix.platform_id == 'win_amd64'
uses: ilammy/msvc-dev-cmd@v1
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.19.2 setuptools toml
- name: Get package name and version (Linux / Mac)
if: ${{ ! startsWith(matrix.os, 'windows-') }}
run: |
echo "PACKAGE_NAME=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])" )" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])" )" >> $GITHUB_ENV
# Some shells require "-Encoding utf8" to append to GITHUB_ENV
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions?tool=powershell#environment-files
- name: Get package name and version (Windows)
if: startsWith(matrix.os, 'windows-')
run: |
echo "PACKAGE_NAME=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])" )" | Out-File -FilePath $env:GITHUB_ENV ` -Append
echo "PACKAGE_VERSION=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])" )" | Out-File -FilePath $env:GITHUB_ENV ` -Append
- name: Determine macOS version
if: startsWith(matrix.os, 'macos-')
run: |
macos_version=$(sw_vers -productVersion | awk -F '.' '{print $1".0"}')
echo "MACOSX_DEPLOYMENT_TARGET=${macos_version}" >> $GITHUB_ENV
- name: Build wheels
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_BUILD: cp${{ matrix.cibw_python }}-${{ matrix.platform_id }}
CIBW_TEST_SKIP: "cp*" # We will test during install and test step
# Include latest Python beta
CIBW_PRERELEASE_PYTHONS: True
CIBW_BEFORE_ALL_LINUX: |
echo "Installing system dependencies with yum"
yum install -y gcc-c++ libpng-devel libpng
echo "pip installing cmake and ninja"
python -m pip install cmake ninja setuptools
CIBW_BEFORE_ALL_WINDOWS: |
python -m pip install cmake ninja setuptools
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_MACOS: |
CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} CMAKE_PREFIX_PATH=/usr/local
CIBW_BEFORE_ALL_MACOS: |
python -m pip install cmake ninja setuptools
brew update
if ! brew list libpng &>/dev/null; then
HOMEBREW_NO_AUTO_UPDATE=1 brew install libpng
fi
run: python -m cibuildwheel --output-dir wheelhouse/cp${{ matrix.cibw_python }}-${{matrix.platform_id }}
- name: Install and test (Linux / Mac)
if: ${{ ! startsWith(matrix.os, 'windows-') }}
run: |
python -m pip install wheelhouse/cp${{ matrix.cibw_python }}-${{matrix.platform_id }}/*.whl
tests/run_tests.sh
- name: Install and test (Windows)
if: startsWith(matrix.os, 'windows-')
shell: bash
run: |
python -m pip install --find-links=./wheelhouse/cp${{ matrix.cibw_python }}-${{ matrix.platform_id }} antspyx
bash tests/run_tests.sh
- uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-cp${{ matrix.cibw_python }}-${{ matrix.platform_id }}
path: ./wheelhouse/cp${{ matrix.cibw_python }}-${{ matrix.platform_id }}/*.whl
- name: Upload release asset
# Previously was using actions/upload-release-asset@v1 , but this had some
# errors with large files
uses: ncipollo/[email protected]
if: ${{ github.event_name == 'release' }}
with:
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
artifacts: ./wheelhouse/cp${{ matrix.cibw_python }}-${{ matrix.platform_id }}/*.whl
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish prep
if: ${{ (github.event_name == 'release') }}
run: |
mywhl=`find ~/ -name "antspyx*.whl"`
extrawheeldir=`dirname $mywhl`
wheeldirx=`dirname $extrawheeldir`
wheeldir=`dirname $wheeldirx`
wheeldir=${wheeldir}/dist
mkdir -p $wheeldir
echo $wheeldir
mv $mywhl $wheeldir
rm -r -f $extrawheeldir $wheeldirx
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
if: ${{ (github.event_name == 'release') && (runner.os == 'Linux') }}
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verify_metadata: false
skip_existing: true
verbose: true