-
Notifications
You must be signed in to change notification settings - Fork 0
245 lines (242 loc) · 7.91 KB
/
ci-python.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
---
name: Python CI
"on":
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- released
env:
DEBIAN_FRONTEND: noninteractive
CARGO_INCREMENTAL: "false"
SCCACHE_GHA_ENABLED: "on"
jobs:
lint:
strategy:
fail-fast: false
matrix:
job:
- black
- mypy
- ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
cache: "poetry"
- run: poetry install --only=dev
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: taiki-e/install-action@v2
with:
tool: just,sccache
- run: poetry run just ci-lint-${{ matrix.job }}
build:
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- run: poetry install --only=dev
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: taiki-e/install-action@v2
with:
tool: just,sccache
- run: poetry run just ci-build-python
- uses: actions/upload-artifact@v4
with:
name: python-${{ matrix.python-version }}-build
path: dist
test:
needs: build
strategy:
fail-fast: false
matrix:
job:
- mit
# Several issues in k5test preventing us from running kadmind with it currently
# - h5l
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
runs-on: ubuntu-latest
env:
KRB5_TRACE: /dev/stderr
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- run: poetry install --only=test
- uses: taiki-e/install-action@v2
with:
tool: just
- uses: actions/download-artifact@v4
with:
name: python-${{ matrix.python-version }}-build
path: dist
- run: |
PATH="/usr/lib/heimdal-servers:$PATH" poetry run just ci-test-python-${{ matrix.job }}
check-python:
if: always()
needs:
- lint
- build
- test
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
build-sdist:
needs: check-python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: "poetry"
- run: poetry install --only=dev
- uses: taiki-e/install-action@v2
with:
tool: just
- run: poetry run just ci-build-python-sdist
- uses: actions/upload-artifact@v4
with:
name: python-cibw-sdist
path: dist/*.tar.gz
build-wheels-matrix:
needs: check-python
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pipx install poetry || true
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: "poetry"
- run: poetry install --only=dev
- id: set-matrix
name: compute matrix
run: |
MATRIX="$(
{
poetry run cibuildwheel --print-build-identifiers --platform linux --archs x86_64,aarch64 \
| sed 's/.*/{"cibw-only": "&", "os": "ubuntu-latest"}/' \
&& poetry run cibuildwheel --print-build-identifiers --platform macos --archs x86_64 \
| sed 's/.*/{"cibw-only": "&", "os": "macos-13" }/' \
&& poetry run cibuildwheel --print-build-identifiers --platform macos --archs arm64 \
| sed 's/.*/{"cibw-only": "&", "os": "macos-14" }/'
} | jq --slurp --compact-output '{"include": .}'
)"
echo matrix="$MATRIX" >> "$GITHUB_OUTPUT"
build-wheels:
needs: build-wheels-matrix
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build-wheels-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: docker/setup-qemu-action@v3
if: runner.os == 'Linux'
with:
platforms: all
- uses: pypa/cibuildwheel@v2.21.3
with:
only: "${{ matrix.cibw-only }}"
env:
CIBW_BEFORE_ALL_LINUX: "set -e; curl -sSf https://sh.rustup.rs | sh -s -- -y; yum install -y krb5-devel clang-devel openssl-devel || apk add krb5-dev clang-dev sccache; which sccache && exit 0; curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.8.2/sccache-v0.8.2-$(uname -m)-unknown-linux-musl.tar.gz | tar xvz -C /tmp/; mv /tmp/sccache-v0.8.2-$(uname -m)-unknown-linux-musl/sccache /usr/bin/sccache"
CIBW_BEFORE_ALL_MACOS: "set -e; curl -sSf https://sh.rustup.rs | sh -s -- -y; brew install llvm krb5 sccache"
CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH"
CIBW_ENVIRONMENT_PASS_LINUX: "DEBIAN_FRONTEND CARGO_INCREMENTAL SCCACHE_GHA_ENABLED ACTIONS_CACHE_URL ACTIONS_RUNTIME_TOKEN"
CIBW_ENVIRONMENT_MACOS: "PKG_CONFIG_PATH=/opt/homebrew/opt/krb5/lib/pkgconfig:/usr/local/opt/krb5/lib/pkgconfig MACOSX_DEPLOYMENT_TARGET=14.0 PATH=$HOME/.cargo/bin:$PATH"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux_2_28
CIBW_MANYLINUX_S390X_IMAGE: manylinux_2_28
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux_2_28
- uses: actions/upload-artifact@v4
with:
name: python-cibw-wheels-${{ matrix.cibw-only }}
path: ./wheelhouse/*.whl
merge-dist-artifacts:
needs:
- build-sdist
- build-wheels
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact/merge@v4
with:
name: python-dist
pattern: python-cibw-*
delete-merged: false
release:
needs:
- check-python
- merge-dist-artifacts
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/python-kadmin-rs/version/')
steps:
- uses: actions/download-artifact@v4
with:
pattern: python-cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1