-
Notifications
You must be signed in to change notification settings - Fork 2
271 lines (236 loc) · 7.22 KB
/
ci.yaml
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
name: Build, Test, and deploy
on: [push]
jobs:
prepare-boost:
runs-on: ubuntu-22.04
name: Download and prepare Boost
strategy:
matrix:
boost:
# Used by RMS 12.1 / Python 3.8 and later
- "1.74.0"
# newer versions of macOS (11+) / XCode (14+) have issues compiling Boost older than
- "1.76.0"
# Used by RMS 14.2 / Python 3.11 and later
- "1.81.0"
steps:
- uses: actions/checkout@v4
name: Checkout repository
- name: Restore cached Boost source
id: cache-boost
uses: actions/cache@v3
with:
path: sources/boost/${{ matrix.boost }}
key: boost-${{ matrix.boost }}-${{ hashFiles('bin/fetch-boost.sh') }}
- name: Download Boost, and extract relevant source code
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
./bin/fetch-boost.sh ${{ matrix.boost }}
rm -rf sources/boost/boost_*
rm -rf sources/boost/*.tar.gz
- name: Store Boost source code
uses: actions/upload-artifact@v4
with:
name: boost-${{ matrix.boost }}
path: sources/boost/*
if-no-files-found: error
prepare-fftw:
# Currently, this is the only machine with Apple Silicon
runs-on: macos-13-xlarge
name: Download and prepare FFTW (for Apple Silicon)
strategy:
matrix:
fftw:
- "3.3.10"
steps:
- uses: actions/checkout@v4
name: Checkout repository
- name: Restore cached FFTW
id: cache-fftw
uses: actions/cache@v3
with:
path: |
sources/fftw/${{ matrix.fftw }}
vendor/
key: fftw-${{ matrix.fftw }}-${{ hashFiles('bin/*-fftw.sh') }}
- name: Download & Build FFTW
if: steps.cache-fftw.outputs.cache-hit != 'true'
run: ./bin/compile-fftw.sh ${{ matrix.fftw }}
- name: Store FFTW source, and build artifacts
uses: actions/upload-artifact@v4
with:
name: fftw-${{ matrix.fftw }}
path: |
sources/fftw/*
vendor/*
build:
needs:
- prepare-boost
- prepare-fftw
runs-on: ${{ matrix.os }}
name: Build & Test
strategy:
matrix:
python:
- 3.7
- 3.8 # Included in RMS 12.1, and newer
- 3.9
- "3.10"
- 3.11 # Included in RMS 14.2, and newer
- 3.12
os:
- ubuntu-20.04
- macos-11
- macos-13-xlarge # That is Apple silicone
exclude:
# Python 3.7-3.9 are not available on ARM64
- os: macos-13-xlarge
python: 3.7
- os: macos-13-xlarge
python: 3.8
- os: macos-13-xlarge
python: 3.9
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
filter: tree:0
- name: Download Boost versions
uses: actions/download-artifact@v4
with:
pattern: boost-*
path: sources/boost/
merge-multiple: true
- name: Download FFTW source
if: ${{ runner.os == 'macOS' && (runner.arch == 'ARM64' || runner.arch == 'ARM') }}
uses: actions/download-artifact@v4
with:
pattern: fftw-*
path: .
merge-multiple: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Build
env:
PYTHON: python${{ matrix.python }}
VERBOSE: "1"
run: |
if [[ $RUNNER_OS == "Linux" ]]; then
# Ensure shared directories have the correct permissions
mkdir -p dist wheelhouse
docker-compose run build-linux
elif [[ $RUNNER_OS == "macOS" ]]; then
make build
else
# That is, windows
echo "No supported, yet" >/dev/stderr
exit 1
fi
shell: bash
- name: Test
run: make tests
- name: Move results from auditwheel
# The reason for this, is because setuptools_scm and auditwheel
# causes an incompatibility between the updated wheels, which causes the installation during tests to fail
if: ${{ runner.os == 'Linux' }}
run: |
mv wheelhouse/*.whl dist/
- name: Store wheels
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.python }}-${{ matrix.os }}
path: dist/*.whl
if-no-files-found: error
source-distribution:
runs-on: ubuntu-20.04
name: Create source distribution (sdist)
needs:
- prepare-boost
- prepare-fftw
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
filter: tree:0
- uses: actions/setup-python@v4
with:
python-version: "3.7" # Minimum supported version
- name: Download Boost versions
uses: actions/download-artifact@v4
with:
pattern: boost-*
path: sources/boost/
merge-multiple: true
- name: Download FFTW source
uses: actions/download-artifact@v4
with:
pattern: fftw-*
path: .
merge-multiple: true
- name: Create source distribution
run: |
./bin/prepare-sdist.sh
make build-sdist
- name: Store source distribution
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
if-no-files-found: error
check-created-artifacts:
runs-on: ubuntu-20.04
name: Check that all the created artifacts have a consistent version
needs:
- build
- source-distribution
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
filter: tree:0
- name: Download compiled wheels
uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: .
merge-multiple: true
- name: Download source distribution
uses: actions/download-artifact@v4
with:
name: sdist
- name: Gather wheels and source distribution
run: |
mkdir -p dist/
mv *.whl dist/
mv *.tar.gz dist/
- name: Ensure artifacts have consistent version
run: ./bin/ensure-consistent-version.sh
- name: Package all artifacts
uses: actions/upload-artifact@v4
with:
name: distribution
path: dist/
if-no-files-found: error
publish:
runs-on: ubuntu-20.04
name: Publish wheels, and source to PyPi
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- check-created-artifacts
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Download distribution
uses: actions/download-artifact@v4
with:
name: distribution
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1