-
Notifications
You must be signed in to change notification settings - Fork 10
253 lines (229 loc) · 8.92 KB
/
tests+pypi.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
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
name: tests+pypi
defaults:
run:
shell: bash
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 13 * * 4'
release:
types: [published]
jobs:
debug_build_ok:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- run: DEBUG=1 VERBOSE=1 pip install --verbose -e .[tests]
- run: pytest -v -s -We -p no:unraisableexception tests
zenodo_json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: notiz-dev/github-action-json-property@release
with:
path: '.zenodo.json'
prop_path: 'creators'
build:
needs: [debug_build_ok, zenodo_json]
strategy:
matrix:
include:
- platform: windows-latest
python-version: "3.8"
- platform: windows-latest
python-version: "3.9"
- platform: windows-latest
python-version: "3.10"
- platform: windows-latest
python-version: "3.11"
- platform: windows-latest
python-version: "3.12"
- platform: macos-13
python-version: "3.8"
- platform: macos-13
python-version: "3.9"
- platform: macos-13
python-version: "3.10"
- platform: macos-13
python-version: "3.11"
- platform: macos-13
python-version: "3.12"
- platform: macos-13
python-version: "3.13"
- platform: macos-14
python-version: "3.10"
- platform: macos-14
python-version: "3.11"
- platform: macos-14
python-version: "3.12"
- platform: macos-14
python-version: "3.13"
- manylinux: "manylinux2010_x86_64"
platform: ubuntu-latest
python-version: "3.8"
- manylinux: "manylinux2010_x86_64"
platform: ubuntu-latest
python-version: "3.9"
- manylinux: "manylinux2010_x86_64"
platform: ubuntu-latest
python-version: "3.10"
- manylinux: "manylinux_2_24_x86_64"
platform: ubuntu-latest
python-version: "3.8"
- manylinux: "manylinux_2_24_x86_64"
platform: ubuntu-latest
python-version: "3.9"
- manylinux: "manylinux_2_24_x86_64"
platform: ubuntu-latest
python-version: "3.10"
- manylinux: "manylinux_2_24_x86_64"
platform: ubuntu-latest
python-version: "3.11"
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- if: startsWith(matrix.platform, 'macos-')
run: |
brew reinstall gcc
for i in /Applications/Xcode_*.app; do sudo xcode-select -s "$i"; break; done;
echo MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion` >> $GITHUB_ENV
echo ARCHFLAGS="-arch `uname -m`" >> $GITHUB_ENV # this seems to have no effect on whl name on Python 3.11!
- if: matrix.platform == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-ninja
m4
- if: matrix.platform == 'windows-latest'
run: |
echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV
echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV
echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV
echo TEMP="D:/a/_temp/" >> $GITHUB_ENV
- uses: jwlawson/[email protected]
with:
cmake-version: '3.26.x'
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install --upgrade pip==24.3.1
- run: python -m pip install $PIP_INSTALL_OPTS "build<1.1" wheel
- run: cmake --version
- run: |
unset CI
python -m build 2>&1 | tee build.log
exit `fgrep -i warning build.log | grep -v "WARNING setuptools_scm" | grep -v "-warnings" | grep -v "All Warnings are enabled" | wc -l`
- if: ${{ (matrix.platform == 'macos-13' && matrix.python-version == '3.11') || matrix.platform == 'macos-14' }}
run: |
# workaround for buggy universal2 wheel names (contain single arch binary only!)
for whl in dist/*_universal2.whl; do
export arch=`python -c 'import platform; print(platform.machine())'`;
export whl_new=${whl/_universal2/_$arch};
mv $whl $whl_new;
python -m wheel unpack $whl_new;
export whl_new_unpacked=`basename $whl_new | cut -d- -f-2`;
sed -i '' 's/_universal2/_$arch/g' $whl_new_unpacked/$whl_new_unpacked.dist-info/WHEEL;
python -m wheel pack $whl_new_unpacked;
done
- if: matrix.platform == 'ubuntu-latest'
run: rm dist/*
- if: matrix.platform == 'ubuntu-latest'
run: |
python -c "import sys; vi=sys.version_info; abitag='m' if vi.minor<8 else ''; print(f'PV=cp{vi.major}{vi.minor}-cp{vi.major}{vi.minor}{abitag}')" >> $GITHUB_ENV
- if: ${{ matrix.platform == 'ubuntu-latest' && matrix.manylinux == 'manylinux2010_x86_64' }}
uses: RalfG/[email protected]_x86_64
with:
python-versions: ${{ env.PV }}
build-requirements: 'setuptools_scm'
pre-build-command: 'git config --global --add safe.directory "*"'
- if: ${{ matrix.platform == 'ubuntu-latest' && matrix.manylinux == 'manylinux_2_24_x86_64' }}
uses: RalfG/[email protected]_2_24_x86_64
with:
python-versions: ${{ env.PV }}
build-requirements: 'setuptools_scm'
pre-build-command: 'git config --global --add safe.directory "*"'
- if: matrix.platform == 'ubuntu-latest'
run: rm dist/*-linux_*
# case sensitivity issue - avoid coexisting PyPartMC-... and pypartmc-... files
# https://github.com/pypi/warehouse/issues/15824
- run: rm -f dist/pypartmc*.tar.gz
- uses: actions/upload-artifact@v4
with:
name: dist-${{matrix.platform}}-${{matrix.manylinux}}-${{matrix.python-version}}
path: dist
- env:
SYSTEM_VERSION_COMPAT: 0
run: |
python -m pip debug --verbose
for i in dist/*.whl; do python -m pip install $PIP_INSTALL_OPTS $i[tests]; done;
python -m pip show --verbose PyPartMC
### make sure PyPartMC is not picked up from a local folder
- run: |
cd tests
python -c "import PyPartMC"
python -m pytest --durations=10 -v -s -We -p no:unraisableexception .
cd ..
- run: |
python -m pip install $PIP_INSTALL_OPTS -r gitmodules/devops_tests/requirements.txt
ex -sc 'g/^PyPartMC/d' -cx .binder/requirements.txt
python -m pip install $PIP_INSTALL_OPTS -r .binder/requirements.txt
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python -m pytest --durations=10 -v -s -We -p no:unraisableexception gitmodules/devops_tests
### uncomment to gain ssh access in case of failure
# - if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
dist_check:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/[email protected]
with:
python-version: "3.11"
- run: pip install twine auditwheel
- uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist
- run: twine check --strict dist/*
- run: for i in dist/*-manylinux*.whl; do auditwheel show $i; done;
dist_upload:
runs-on: ubuntu-latest
needs: [dist_check]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
repository_url: https://test.pypi.org/legacy/
attestations: false
- run: |
echo "github.event_name:" ${{ github.event_name }}
echo "github.event.action:" ${{ github.event.action }}
echo "github.event.prerelease:" ${{ github.event.prerelease }}
echo "env.GITHUB_REF:" ${{ env.GITHUB_REF }}
echo "env.GITHUB_REF:" ${{ env.GITHUB_REF_NAME }}
- if: github.event_name == 'release' && github.event.prerelease == false
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
attestations: false