-
Notifications
You must be signed in to change notification settings - Fork 58
217 lines (186 loc) · 6.01 KB
/
wheel.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
# this is based on the wheel workflow in GalSim, but adapted to our needs
name: build wheels and sdist
on:
workflow_dispatch:
inputs:
ref:
description: 'The git ref to build wheels for. This will trigger a pypi upload.'
default: ''
required: false
type: string
cibw_skip:
description: 'Python versions to skip when building wheels.'
default: 'cp36* cp37* pp* cp38*'
required: false
type: string
pull_request: null
release:
types:
- published
concurrency:
group: pypi
cancel-in-progress: false
env:
PYVER: '3.11'
CIBW_SKIP_VAL: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.cibw_skip || 'cp36* cp37* pp* cp38*' }}
jobs:
linux-manylinux:
name: linux-manylinux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || '' }}
- uses: actions/setup-python@v5
with:
python-version: '${{ env.PYVER }}'
- name: build wheels
uses: pypa/cibuildwheel@v2.21.1
env:
CIBW_BUILD: "*manylinux*"
CIBW_ARCHS: auto64
CIBW_SKIP: ${{ env.CIBW_SKIP_VAL }}
# I think yum might always work here. But leave all options available.
CIBW_BEFORE_ALL: yum install -y bzip2-devel || apt-get install libbz2-dev || apk add --upgrade bzip2-dev
- name: test wheel for python ${{ env.PYVER }}
run: |
pystr='${{ env.PYVER }}'
pystr=${pystr//./}
python -m pip install pip
pip install numpy pytest
pip install ./wheelhouse/*cp${pystr}*.whl
pytest --pyargs fitsio
- uses: actions/upload-artifact@v4
with:
name: whl-linux
path: ./wheelhouse/*.whl
linux-musl:
name: linux-musl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '${{ env.PYVER }}'
- name: build wheels
uses: pypa/cibuildwheel@v2.21.1
env:
CIBW_BUILD: "*musllinux*"
CIBW_ARCHS: auto64
CIBW_SKIP: ${{ env.CIBW_SKIP_VAL }}
# I think musl always uses apk, but keep all options available.
CIBW_BEFORE_ALL: yum install -y bzip2-devel || apt-get install libbz2-dev || apk add --upgrade bzip2-dev
- uses: jirutka/setup-alpine@v1
with:
packages: "bzip2-dev python3 py3-pip py3-numpy"
- name: test wheel for python
shell: alpine.sh {0}
run: |
python --version
pystr=$(python --version | cut -d' ' -f 2 | cut -d'.' -f 1)$(python --version | cut -d' ' -f 2 | cut -d'.' -f 2)
mkdir test-venv
python3 -m venv test-venv
. test-venv/bin/activate
pip install numpy pytest
pip install ./wheelhouse/*cp${pystr}*musl*.whl
pytest --pyargs fitsio
deactivate
- uses: actions/upload-artifact@v4
with:
name: whl-musl
path: ./wheelhouse/*.whl
osx-intel:
name: osx-intel
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '${{ env.PYVER }}'
- name: build wheels
uses: pypa/cibuildwheel@v2.21.1
env:
CIBW_BUILD: "*macosx*"
CIBW_ARCHS: auto64
CIBW_SKIP: ${{ env.CIBW_SKIP_VAL }}
# CIBW_BEFORE_ALL: brew install fftw || true
CIBW_ENVIRONMENT: >-
MACOSX_DEPLOYMENT_TARGET=13.0
- name: test wheel for python ${{ env.PYVER }}
run: |
pystr='${{ env.PYVER }}'
pystr=${pystr//./}
python -m pip install pip
pip install numpy pytest
pip install ./wheelhouse/*cp${pystr}*.whl
pytest --pyargs fitsio
- uses: actions/upload-artifact@v4
with:
name: whl-macos
path: ./wheelhouse/*.whl
osx-arm:
name: osx-arm
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '${{ env.PYVER }}'
- name: build wheels
uses: pypa/cibuildwheel@v2.21.1
env:
CIBW_BUILD: "*macosx*"
CIBW_ARCHS: arm64
CIBW_SKIP: ${{ env.CIBW_SKIP_VAL }}
# CIBW_BEFORE_ALL: brew install llvm libomp fftw eigen
CIBW_ENVIRONMENT: >-
MACOSX_DEPLOYMENT_TARGET=14.7
- name: test wheel for python ${{ env.PYVER }}
run: |
pystr='${{ env.PYVER }}'
pystr=${pystr//./}
python -m pip install pip
pip install numpy pytest
pip install ./wheelhouse/*cp${pystr}*.whl
pytest --pyargs fitsio
- uses: actions/upload-artifact@v4
with:
name: whl-arm
path: ./wheelhouse/*.whl
sdist:
name: sdist
needs: [linux-manylinux, linux-musl, osx-intel, osx-arm]
# Just need to build sdist on a single machine
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U numpy setuptools
- name: download wheels
uses: actions/download-artifact@v4
with:
path: ./wheels
pattern: whl-*
merge-multiple: true
- name: build sdist
run: |
python setup.py sdist
ls -l dist
tar tvfz dist/*.tar.gz
- name: copy wheels to dist
run: |
echo ls -l wheels
ls -l wheels
cp wheels/*.whl dist
echo ls -l dist
ls -l dist
- name: publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release' || github.event.action == 'workflow_dispatch'
with:
verbose: true
skip-existing: true
password: ${{ secrets.PYPI_API_TOKEN }}