-
Notifications
You must be signed in to change notification settings - Fork 1
384 lines (309 loc) · 9.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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
#
# GitHub actions to test chevah-compat.
#
# Available VMs. Don't use `-latest` as we want to pin an OS version.
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
#
# Available images https://github.com/actions/runner-images
#
# When running a tmate debug session you might need to increase the
# timeout-minutes for each build.
name: CI
on:
push:
branches: [ master ]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
# Try to run using oldest Ubuntu version available on GitHub
ubuntu-old-unicode-path:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
timeout-minutes: 30
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Cache build
uses: actions/cache@v4
with:
path: |
build-py3
key: ${{ runner.os }}-${{ hashFiles('pavement.py') }}-${{ hashFiles('pythia.conf') }}-unicode
- name: Deps
run: ./pythia.sh deps
- uses: chevah/python-info-action@v1
with:
python-path: build-py3/bin/python
- name: Move build to Unicode path
run: mv build-py3 build-py3-ț
- name: Tmate debug on failure
if: ${{ !cancelled() && runner.debug }}
uses: chevah/action-tmate@v3
with:
limit-access-to-actor: true
- name: Test pynose
run: |
./pythia.sh test_ci2
env:
CHEVAH_BUILD: build-py3-ț
- name: Test pytest
run: |
./pythia.sh pytest
env:
CHEVAH_BUILD: build-py3-ț
- name: Test pytest elevated
run: |
sudo -E ./pythia.sh pytest src/chevah_compat/tests/elevated/
env:
CHEVAH_BUILD: build-py3-ț
- name: Move build back to to ascii
run: mv build-py3-ț build-py
# Try to run with latest Ubuntu version available on GitHub
ubuntu-latest-ascii-path:
runs-on: ubuntu-24.04
timeout-minutes: 30
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Fail on skip-ci
if: ${{ github.event.after }}
run: git log -1 --pretty=format:"%s" ${{ toJSON(github.event.after) }} | grep -v 'skip-ci'
- name: Cache build
uses: actions/cache@v4
with:
path: |
build-py3
key: ${{ runner.os }}-${{ hashFiles('pavement.py') }}-${{ hashFiles('pythia.conf') }}-ascii
- name: Deps
run: ./pythia.sh deps
- name: Tmate debug on failure
if: ${{ !cancelled() && runner.debug }}
uses: chevah/action-tmate@v3
with:
limit-access-to-actor: true
- name: Test
run: ./pythia.sh test_ci2
env:
CODECOV_TOKEN: enabled
- name: Test pytest
run: |
./pythia.sh pytest
- name: Test pytest elevated
run: |
sudo -E ./pythia.sh pytest src/chevah_compat/tests/elevated/
- name: Publish cov
run: ./pythia.sh codecov_publish
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Lint
run: ./pythia.sh lint --no-cache
macos-m1-unicode-path:
strategy:
fail-fast: false
matrix:
runs-on: [ macos-14 ]
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Cache build
uses: actions/cache@v4
with:
path: |
build-py3
key: ${{ runner.os }}-${{ hashFiles('pavement.py') }}-${{ hashFiles('pythia.conf') }}-unicode
- name: Deps
run: ./pythia.sh deps
- name: Move build to Unicode path
run: mv build-py3 build-py3-ț
- name: Tmate debug on failure
if: ${{ !cancelled() && runner.debug }}
uses: chevah/action-tmate@v3
with:
limit-access-to-actor: true
- name: Test
run: ./pythia.sh test_ci2
env:
CHEVAH_BUILD: build-py3-ț
CODECOV_TOKEN: enabled
- name: Move build back to to ascii
run: mv build-py3-ț build-py3
- name: Publish cov
run: ./pythia.sh codecov_publish
env:
CODECOV_TOKEN: enabled
- name: Deps
run: |
./pythia.sh deps
./pythia.sh build
- name: Tmate debug on failure
if: ${{ !cancelled() && runner.debug }}
uses: chevah/action-tmate@v3
with:
limit-access-to-actor: true
- name: Test
run: ./pythia.sh test_ci2
env:
CODECOV_TOKEN: enabled
- name: Test pytest
run: |
./pythia.sh pytest
- name: Test pytest elevated
run: |
sudo -E ./pythia.sh pytest src/chevah_compat/tests/elevated/
- name: Publish cov
run: ./pythia.sh codecov_publish
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Lint
run: ./pythia.sh lint --no-cache
windows:
runs-on: 'windows-2022'
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
- name: Cache build
uses: actions/cache@v4
with:
path: |
build-py3
key: ${{ runner.os }}-${{ hashFiles('pavement.py') }}-${{ hashFiles('pythia.conf') }}
- name: Deps
run: |
./pythia.sh deps
./pythia.sh build
- name: Tmate debug on failure
if: ${{ !cancelled() && runner.debug }}
uses: chevah/action-tmate@v3
with:
limit-access-to-actor: true
# FIXME:691:
# We should have just a single test step here to run all the tests in one
# go.
# Not sure why on Windows the normal tests are not discovered by default.
- name: Test normal
run: |
./pythia.sh test -vs normal
env:
CODECOV_TOKEN: enabled
USER: runneradmin
- name: Test elevated
run: |
./pythia.sh test_ci2 elevated
env:
CODECOV_TOKEN: enabled
USER: runneradmin
- name: Test pytest
run: |
./pythia.sh pytest
env:
USER: runneradmin
- name: Test pytest elevated
run: |
./pythia.sh pytest src/chevah_compat/tests/elevated/
env:
USER: runneradmin
- name: Public coverage
if: ${{ !cancelled() }}
run: ./pythia.sh codecov_publish
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Lint
run: ./pythia.sh lint --no-cache
docker:
name: docker-${{ matrix.container }}
container: ${{ matrix.container }}
env:
CHEVAH_REPO: compat
USER: chevah
CHEVAH_CONTAINER: yes
defaults:
run:
shell: sh
strategy:
fail-fast: false
matrix:
container:
- alpine:3.16
- amazonlinux:2022
- oraclelinux:8
- rockylinux:9
- ubuntu:22.04
- ubuntu:24.04
# ubuntu-latest is GitHub's newest well-suported Linux distro.
runs-on: ubuntu-latest
timeout-minutes: 15
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Alpine setup
if: startsWith(matrix.container, 'alpine')
run: apk add git bash shadow sudo curl tar
- name: Amazon Linux 2022 setup
if: matrix.container == 'amazonlinux:2022' || matrix.container == 'rockylinux:9'
run: yum -y install libxcrypt-compat findutils
- name: Yum-based setup
if: startsWith(matrix.container, 'rocky') || startsWith(matrix.container, 'amazon') || startsWith(matrix.container, 'oracle')
run: yum -y install git tar which sudo
- name: Ubuntu setup
if: startsWith(matrix.container, 'ubuntu')
run: |
apt-get update
apt-get dist-upgrade -y
apt-get install -y git curl sudo
# On a Docker container, everything runs as root by default.
- name: Chevah user setup
run: |
useradd -g adm -s /bin/bash -m chevah
echo '%adm ALL=NOPASSWD: ALL' > /etc/sudoers
- uses: actions/checkout@v4
- name: Cache build
uses: actions/cache@v4
with:
path: |
build-py3
key: ${{ runner.os }}-${{ hashFiles('pavement.py') }}-${{ hashFiles('pythia.conf') }}-${{ matrix.container }}
- name: Deps
run: |
chown -R chevah .
su chevah -c "./pythia.sh deps"
- uses: chevah/python-info-action@v1
with:
python-path: build-py3/bin/python
- name: Build
run: |
su chevah -c "./pythia.sh build"
- name: Test
run: |
su chevah -c "./pythia.sh test_ci2"
# Helper so that on GitHub repo settings we can configure a single job as
# required.
ci-required:
runs-on: ubuntu-latest
timeout-minutes: 10
if: always()
needs:
- ubuntu-old-unicode-path
- ubuntu-latest-ascii-path
- macos-m1-unicode-path
- windows
- docker
steps:
- name: Require all successes
shell: python3 {0}
env:
RESULTS: ${{ toJSON(needs.*.result) }}
run: |
import json
import os
import sys
results = json.loads(os.environ["RESULTS"])
sys.exit(0 if all(result == "success" for result in results) else 1)