-
Notifications
You must be signed in to change notification settings - Fork 101
185 lines (162 loc) · 5.47 KB
/
wheel_tests_and_release.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
# Adapted from https://github.com/scikit-image/scikit-image/blob/main/.github/workflows/wheel_tests_and_release.yml
name: Build Wheels and Release
on:
push:
tags:
- 'v*'
branches:
- maintenance/**
- '!main'
env:
CIBW_BUILD_VERBOSITY: 2
CIBW_BEFORE_BUILD: pip install numpy
CIBW_TEST_REQUIRES: "-r requirements.txt pytest"
CIBW_TEST_COMMAND: pytest --pyargs cesium
CIBW_ENVIRONMENT: PIP_PREFER_BINARY=1
permissions:
contents: read
jobs:
build_linux_wheels:
name: Build python ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
cibw_python: ["cp310-*", "cp311-*", "cp312-*"]
cibw_manylinux: [manylinux2014]
cibw_arch: ["x86_64"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: '3.10'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Build the wheel
run: |
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }}
CIBW_SKIP: "*-musllinux_*"
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.cibw_manylinux }}
CIBW_ENVIRONMENT_PASS_LINUX: CESIUM_LINK_FLAGS
CESIUM_LINK_FLAGS: "-Wl,--strip-debug"
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/*.whl
build_macos_wheels:
name: Build python ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
cibw_python: ["cp310-*", "cp311-*", "cp312-*"]
cibw_arch: [ "x86_64", "arm64"] #, "universal2"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: '3.10'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Build wheels for CPython Mac OS
run: |
if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then
# SciPy requires 12.0 on arm to prevent kernel panics
# https://github.com/scipy/scipy/issues/14688
# so being conservative, we just do the same here
export MACOSX_DEPLOYMENT_TARGET=12.0
else
export MACOSX_DEPLOYMENT_TARGET=10.9
fi
echo MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
CIBW_TEST_SKIP: "*-macosx_arm64"
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/*.whl
build_windows_wheels:
name: Build python ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
cibw_python: ["cp310-*", "cp311-*", "cp312-*"]
cibw_arch: ["AMD64"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: '3.10'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Build Windows wheels for CPython
run: |
python -m cibuildwheel --output-dir dist
env:
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }}
# -Wl,-S equivalent to gcc's -Wl,--strip-debug
LDFLAGS: "-Wl,-S"
- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/*.whl
deploy:
name: Release
needs: [build_linux_wheels, build_macos_wheels, build_windows_wheels]
if: github.repository_owner == 'cesium-ml' && startsWith(github.ref, 'refs/tags/v') && always()
runs-on: ubuntu-latest
permissions:
contents: write # for softprops/action-gh-release to create GitHub release
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build setuptools_scm
- name: Build the source distribution
run: |
pyproject-build . --sdist --no-isolation --skip-dependency-check
ls -la ${{ github.workspace }}/dist
- uses: actions/[email protected]
id: download
with:
name: wheels
path: ./dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
- name: Github release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}