-
-
Notifications
You must be signed in to change notification settings - Fork 53
538 lines (464 loc) · 17.9 KB
/
ci.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
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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
---
name: CI
on: [ push, pull_request ]
env:
pcre2: pcre2-10.40
wc: wc
build: build
cvtpcre: build/test/retest
prefix: prefix
maintainer: kate@elide.org
jobs:
checkout:
name: "Checkout"
runs-on: ubuntu-latest
steps:
- name: Cache checkout
uses: actions/cache@v3
id: cache-checkout
with:
path: ${{ env.wc }}
key: checkout-${{ github.sha }}
- name: Checkout
if: steps.cache-checkout.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
submodules: recursive
path: ${{ env.wc }}
- name: Uncouple docs test
if: steps.cache-checkout.outputs.cache-hit != 'true'
run: sed -ie 's,^test::,doc-test::,' ${{ env.wc }}/share/mk/man.mk
- name: chmod read only
if: steps.cache-checkout.outputs.cache-hit != 'true'
run: |
chmod -R ug-w ${{ env.wc }}
chmod -R ug+w ${{ env.wc }}/.git # post-checkout sets git config
pcre_suite:
name: "Import PCRE suite"
runs-on: ubuntu-latest
needs: [ build ] # for cvtpcre
steps:
- name: Cache PCRE suite
uses: actions/cache@v3
id: cache-pcre
with:
path: pcre-suite/${{ env.pcre2 }}
key: ${{ env.pcre2 }}
- name: Fetch PCRE suite
if: steps.cache-pcre.outputs.cache-hit != 'true'
run: |
wget -nv -P pcre-suite/ https://github.com/PCRE2Project/pcre2/releases/download/${{ env.pcre2 }}/${{ env.pcre2 }}.zip
unzip -d pcre-suite/ pcre-suite/${{ env.pcre2 }}.zip "${{ env.pcre2 }}/testdata/*"
- name: chmod read only
if: steps.cache-pcre.outputs.cache-hit != 'true'
run: |
chmod -R ug-w pcre-suite
- name: Cache converted PCRE tests
uses: actions/cache@v3
id: cache-cvtpcre
with:
path: ${{ env.cvtpcre }}
key: cvtpcre-bmake-ubuntu-gcc-DEBUG-ASAN-${{ github.sha }}-${{ env.pcre2 }}
- name: Fetch build
if: steps.cache-cvtpcre.outputs.cache-hit != 'true'
uses: actions/cache@v3
id: cache-build
with:
path: ${{ env.build }}
key: build-bmake-ubuntu-gcc-DEBUG-ASAN-${{ github.sha }} # arbitary build, just for cvtpcre
- name: Convert PCRE suite
if: steps.cache-cvtpcre.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.cvtpcre }}
# the regexps skipped here take too long to compile in CI at the moment
for i in $(cd pcre-suite/${{ env.pcre2 }}/testdata; ls -1 testinput*); do
./${{ env.build }}/bin/cvtpcre \
-s 'word (?:[a-zA-Z0-9]+ ){0,300}otherword' \
-s 'Z*(|d*){216}' \
-s 'X?(R||){3335}' \
-s '(|]+){2,2452}' \
-s 'z{65536}' \
< pcre-suite/${{ env.pcre2 }}/testdata/$i \
> ./${{ env.cvtpcre }}/$i.tst
done
# things which will probably never be relevant for us:
rm ${{ env.cvtpcre }}/testinput2.tst # pcre options
rm ${{ env.cvtpcre }}/testinput3.tst # locale
rm ${{ env.cvtpcre }}/testinput5.tst # pcre options
rm ${{ env.cvtpcre }}/testinput8.tst # pcre bytecode
rm ${{ env.cvtpcre }}/testinput9.tst # character encodings
rm ${{ env.cvtpcre }}/testinput10.tst # character encodings
rm ${{ env.cvtpcre }}/testinput11.tst # character encodings
rm ${{ env.cvtpcre }}/testinput12.tst # character encodings
rm ${{ env.cvtpcre }}/testinput13.tst # character encodings
rm ${{ env.cvtpcre }}/testinput15.tst # backtracking limits
rm ${{ env.cvtpcre }}/testinput16.tst # JIT options
rm ${{ env.cvtpcre }}/testinput17.tst # JIT options
rm ${{ env.cvtpcre }}/testinput20.tst # serialisation
rm ${{ env.cvtpcre }}/testinput21.tst # \C
rm ${{ env.cvtpcre }}/testinput22.tst # \C
rm ${{ env.cvtpcre }}/testinput23.tst # \C
rm ${{ env.cvtpcre }}/testinputEBC.tst # EBCDIC
# things we should eventually support, but don't yet:
rm ${{ env.cvtpcre }}/testinput4.tst # we don't provide UTF8 yet
rm ${{ env.cvtpcre }}/testinput7.tst # we don't provide UTF8 yet
rm ${{ env.cvtpcre }}/testinput14.tst # we don't provide UTF8 yet
rm ${{ env.cvtpcre }}/testinput18.tst # POSIX dialect
rm ${{ env.cvtpcre }}/testinput19.tst # POSIX dialect
rm ${{ env.cvtpcre }}/testinput24.tst # POSIX dialect
rm ${{ env.cvtpcre }}/testinput25.tst # POSIX dialect
- name: chmod read only
if: steps.cache-cvtpcre.outputs.cache-hit != 'true'
run: |
chmod -R ug-w ${{ env.cvtpcre }}
build:
name: "Build ${{ matrix.san }} ${{ matrix.cc }} ${{ matrix.os }} ${{ matrix.debug }}"
runs-on: ${{ matrix.os }}-latest
needs: [ checkout ]
strategy:
fail-fast: true
matrix:
san: [ NO_SANITIZER, ASAN, UBSAN, MSAN, EFENCE ] # NO_SANITIZER=1 is a no-op
os: [ ubuntu ]
cc: [ clang, gcc ]
make: [ bmake ] # we test makefiles separately
debug: [ DEBUG, EXPENSIVE_CHECKS, RELEASE ] # RELEASE=1 is a no-op
exclude:
- os: macos
cc: gcc # it's clang anyway
- os: macos
san: EFENCE # not packaged
- os: macos
san: MSAN # not supported
- os: macos
make: pmake # not packaged
steps:
- name: Fetch checkout
uses: actions/cache@v3
id: cache-checkout
with:
path: ${{ env.wc }}
key: checkout-${{ github.sha }}
- name: Cache build
uses: actions/cache@v3
id: cache-build
with:
path: ${{ env.build }}
key: build-${{ matrix.make }}-${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.debug }}-${{ matrix.san }}-${{ github.sha }}
- name: Dependencies (Ubuntu)
if: matrix.os == 'ubuntu' && steps.cache-build.outputs.cache-hit != 'true'
run: |
uname -a
sudo apt-get install bmake electric-fence
${{ matrix.cc }} --version
- name: Dependencies (MacOS)
if: matrix.os == 'macos' && steps.cache-build.outputs.cache-hit != 'true'
run: |
uname -a
brew update
brew install bmake pcre
${{ matrix.cc }} --version
- name: Get number of CPU cores
if: steps.cache-build.outputs.cache-hit != 'true'
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Make
if: steps.cache-build.outputs.cache-hit != 'true'
run: |
# note: lexer.h first, because parser.? depends on it
find . -name 'lexer.?' -exec touch '{}' \; # workaround for git checkout timestamps
find . -name 'parser.?' -exec touch '{}' \; # workaround for git checkout timestamps
${{ matrix.make }} -r -j $((${{ steps.cpu-cores.outputs.count }} + 1)) -C ${{ env.wc }} BUILD=../${{ env.build }} ${{ matrix.san }}=1 ${{ matrix.debug }}=1 PKGCONF=pkg-config CC=${{ matrix.cc }} NODOC=1
# testing different bmake dialects
# the goal here is to excercise the build system, not the code
# we don't care about e.g. different compilers here
test_makefiles:
name: "Test (Makefiles) ${{ matrix.make }} ${{ matrix.os }} ${{ matrix.debug }}"
runs-on: ${{ matrix.os }}-latest
needs: [ checkout ]
strategy:
fail-fast: false
matrix:
os: [ ubuntu ]
cc: [ clang ]
make: [ bmake, pmake ]
debug: [ DEBUG, RELEASE ] # RELEASE=1 is a no-op
exclude:
- os: macos
make: pmake # not packaged
steps:
- name: Fetch checkout
uses: actions/cache@v3
id: cache-checkout
with:
path: ${{ env.wc }}
key: checkout-${{ github.sha }}
- name: Dependencies (Ubuntu)
if: matrix.os == 'ubuntu'
run: |
uname -a
sudo apt-get install pmake bmake pcregrep
${{ matrix.cc }} --version
- name: Dependencies (MacOS)
if: matrix.os == 'macos'
run: |
uname -a
brew update
brew install bmake pcre
${{ matrix.cc }} --version
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Make
run: |
# note: lexer.h first, because parser.? depends on it
find . -name 'lexer.?' -exec touch '{}' \; # workaround for git checkout timestamps
find . -name 'parser.?' -exec touch '{}' \; # workaround for git checkout timestamps
${{ matrix.make }} -r -j $((${{ steps.cpu-cores.outputs.count }} + 1)) -C ${{ env.wc }} BUILD=../${{ env.build }} ${{ matrix.debug }}=1 PKGCONF=pkg-config CC=${{ matrix.cc }}
- name: Test
# I don't want to build SID just for sake of its -l test
# Same for lx
run: ${{ matrix.make }} -r -j $((${{ steps.cpu-cores.outputs.count }} + 1)) -C ${{ env.wc }} BUILD=../${{ env.build }} ${{ matrix.debug }}=1 PKGCONF=pkg-config SID='true; echo sid' LX='true; echo lx' CC=${{ matrix.cc }} NODOC=1 test
- name: Install
run: ${{ matrix.make }} -r -j $((${{ steps.cpu-cores.outputs.count }} + 1)) -C ${{ env.wc }} BUILD=../${{ env.build }} ${{ matrix.debug }}=1 PKGCONF=pkg-config PREFIX=../${{ env.prefix }} NODOC=1 install
test_san:
name: "Test (Sanitizers) ${{ matrix.san }} ${{ matrix.cc }} ${{ matrix.os }} ${{ matrix.debug }}"
runs-on: ${{ matrix.os }}-latest
needs: [ build ]
strategy:
fail-fast: false
matrix:
san: [ ASAN, UBSAN, MSAN, EFENCE ]
os: [ ubuntu ]
cc: [ clang, gcc ]
make: [ bmake ]
debug: [ DEBUG, EXPENSIVE_CHECKS, RELEASE ] # RELEASE=1 is a no-op
exclude:
- os: macos
cc: gcc # it's clang anyway
- os: macos
san: EFENCE # not packaged
- os: macos
san: MSAN # not supported
steps:
- name: Fetch checkout
uses: actions/cache@v3
id: cache-checkout
with:
path: ${{ env.wc }}
key: checkout-${{ github.sha }}
- name: Dependencies (Ubuntu)
if: matrix.os == 'ubuntu'
run: |
uname -a
sudo apt-get install bmake pcregrep electric-fence
${{ matrix.cc }} --version
- name: Dependencies (MacOS)
if: matrix.os == 'macos'
run: |
uname -a
brew update
brew install bmake pcre
${{ matrix.cc }} --version
- name: Fetch build
uses: actions/cache@v3
id: cache-build
with:
path: ${{ env.build }}
key: build-${{ matrix.make }}-${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.debug }}-${{ matrix.san }}-${{ github.sha }}
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Test
env:
EF_DISABLE_BANNER: 1
# I don't want to build SID just for sake of its -l test
run: ${{ matrix.make }} -r -j $((${{ steps.cpu-cores.outputs.count }} + 1)) -C ${{ env.wc }} BUILD=../${{ env.build }} ${{ matrix.san }}=1 ${{ matrix.debug }}=1 PKGCONF=pkg-config SID='true; echo sid' CC=${{ matrix.cc }} NODOC=1 LX=../${{ env.build }}/bin/lx test
test_pcre:
name: "Test (PCRE suite) ${{ matrix.lang }} ${{ matrix.san }} ${{ matrix.cc }} ${{ matrix.os }} ${{ matrix.debug }}"
runs-on: ${{ matrix.os }}-latest
needs: [ pcre_suite ] # and also build, but pcre_suite gives us that
strategy:
fail-fast: false
matrix:
san: [ ASAN, UBSAN, MSAN, EFENCE ]
os: [ ubuntu ]
cc: [ clang, gcc ]
make: [ bmake ]
debug: [ DEBUG, EXPENSIVE_CHECKS, RELEASE ] # RELEASE=1 is a no-op
lang: [ "vm -x v1", "vm -x v2", asm, c, vmc, vmops ]
exclude:
- os: macos
cc: gcc # it's clang anyway
- os: macos
san: EFENCE # not packaged
- os: macos
san: MSAN # not supported
steps:
- name: Dependencies (Ubuntu)
if: matrix.os == 'ubuntu' && matrix.san == 'EFENCE'
run: |
uname -a
sudo apt-get install electric-fence
${{ matrix.cc }} --version
- name: Dependencies (MacOS)
if: matrix.os == 'macos' && false
run: |
uname -a
brew update
${{ matrix.cc }} --version
- name: Fetch build
uses: actions/cache@v3
id: cache-build
with:
path: ${{ env.build }}
key: build-${{ matrix.make }}-${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.debug }}-${{ matrix.san }}-${{ github.sha }}
- name: Fetch converted PCRE tests
uses: actions/cache@v3
id: cache-cvtpcre
with:
path: ${{ env.cvtpcre }}
key: cvtpcre-bmake-ubuntu-gcc-DEBUG-ASAN-${{ github.sha }}-${{ env.pcre2 }}
- name: Run PCRE suite (${{ matrix.lang }})
run: CC=${{ matrix.cc }} ./${{ env.build }}/bin/retest -O1 -l ${{ matrix.lang }} ${{ env.cvtpcre }}/*.tst
docs:
name: Documentation
runs-on: ubuntu-latest
needs: [ checkout ]
env:
make: bmake
steps:
- name: Cache docs
uses: actions/cache@v3
id: cache-docs
with:
path: ${{ env.build }}
key: docs-${{ github.sha }}
- name: Dependencies (Ubuntu)
if: steps.cache-docs.outputs.cache-hit != 'true'
run: |
uname -a
sudo apt-get update
sudo apt-get install bmake libxml2-utils xsltproc docbook-xml docbook-xsl
- name: Fetch checkout
if: steps.cache-docs.outputs.cache-hit != 'true'
uses: actions/cache@v3
id: cache-checkout
with:
path: ${{ env.wc }}
key: checkout-${{ github.sha }}
- name: Get number of CPU cores
if: steps.cache-docs.outputs.cache-hit != 'true'
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Test docs
if: steps.cache-docs.outputs.cache-hit != 'true'
run: ${{ env.make }} -r -j $((${{ steps.cpu-cores.outputs.count }} + 1)) -C ${{ env.wc }} BUILD=../${{ env.build }} doc-test
- name: make doc
if: steps.cache-docs.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.build }}/man # XXX
${{ env.make }} -r -j $((${{ steps.cpu-cores.outputs.count }} + 1)) -C ${{ env.wc }} BUILD=../${{ env.build }} doc
- name: chmod read only
if: steps.cache-docs.outputs.cache-hit != 'true'
run: |
chmod -R ug-w ${{ env.build }}
install:
name: Install
runs-on: ubuntu-latest
needs: [ build, docs ]
env:
san: NO_SANITIZER # NO_SANITIZER=1 is a no-op
os: ubuntu
cc: clang
make: bmake
debug: RELEASE # RELEASE=1 is a no-op
steps:
- name: Cache prefix
uses: actions/cache@v3
id: cache-prefix
with:
path: ${{ env.prefix }}
key: prefix-${{ env.make }}-${{ env.os }}-${{ env.cc }}-${{ env.debug }}-${{ env.san }}-${{ github.sha }}
- name: Dependencies (Ubuntu)
if: env.os == 'ubuntu' && steps.cache-prefix.outputs.cache-hit != 'true'
run: |
uname -a
sudo apt-get install bmake
- name: Fetch checkout
if: steps.cache-prefix.outputs.cache-hit != 'true'
uses: actions/cache@v3
id: cache-checkout
with:
path: ${{ env.wc }}
key: checkout-${{ github.sha }}
- name: Fetch build
if: steps.cache-prefix.outputs.cache-hit != 'true'
uses: actions/cache@v3
id: cache-build
with:
path: ${{ env.build }}
key: build-${{ env.make }}-${{ env.os }}-${{ env.cc }}-${{ env.debug }}-${{ env.san }}-${{ github.sha }}
- name: Fetch docs
if: steps.cache-prefix.outputs.cache-hit != 'true'
uses: actions/cache@v3
id: cache-docs
with:
path: ${{ env.build }}
key: docs-${{ github.sha }}
- name: Get number of CPU cores
if: steps.cache-prefix.outputs.cache-hit != 'true'
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Install
if: steps.cache-prefix.outputs.cache-hit != 'true'
run: |
chmod ug+w ${{ env.build }}/pc # XXX: written to during make install
bmake -r -j $((${{ steps.cpu-cores.outputs.count }} + 1)) -C ${{ env.wc }} BUILD=../${{ env.build }} PREFIX=../${{ env.prefix }}/usr install
fpm:
name: Package ${{ matrix.pkg }}
runs-on: ubuntu-latest
needs: [ install ]
env:
san: NO_SANITIZER # NO_SANITIZER=1 is a no-op
os: ubuntu
cc: clang
make: bmake
debug: RELEASE # RELEASE=1 is a no-op
strategy:
fail-fast: false
matrix:
# others: cpan, gem, npm, osxpkg, p5p, pear, pkgin, pleaserun, puppet, python, snap, solaris, virtualenv ]
pkg: [ apk, deb, freebsd, rpm, sh, tar, zip ] # XXX: pacman is broken currently
steps:
- name: Dependencies (Ubuntu)
if: env.os == 'ubuntu'
run: |
uname -a
sudo gem install --no-document fpm
fpm -v
- name: Fetch prefix
uses: actions/cache@v3
id: cache-prefix
with:
path: ${{ env.prefix }}
key: prefix-${{ env.make }}-${{ env.os }}-${{ env.cc }}-${{ env.debug }}-${{ env.san }}-${{ github.sha }}
- name: Find version
# TODO: would get a tag or branch name here
run: |
printf "package_version=%s\n" 0.$(echo ${{ github.sha }} | cut -c-7) >> $GITHUB_ENV
printf "package_name=%s\n" $(echo ${{ github.repository }} | cut -f2 -d/) >> $GITHUB_ENV
- name: Package
run: |
mkdir pkg
fpm --log warn -C ${{ env.prefix }} -p pkg/ -n ${{ env.package_name }} -t ${{ matrix.pkg }} -v ${{ env.package_version }} -a $(uname -m) -m ${{ env.maintainer }} -s dir \
| ruby -e 'h = eval(STDIN.read); puts h[:level].to_s.sub("fatal", "::error::").sub("warn", "::warning::") + " " + h[:message]'
# now there's a single file in pkg/ (because this is a matrix build), name format differs per package type
[ -f pkg/*.sh -o -f pkg/*.tar ] && gzip -9 pkg/*
[ -f pkg/${{ env.package_name }}.* ] && mv pkg/* pkg/$(basename pkg/* | sed 's,^${{ env.package_name }}\.,${{ env.package_name }}-${{ env.package_version }}.,') # fix up naming for xyz.{sh,tar,zip}
printf "package_file=%s\n" $(basename pkg/*) >> $GITHUB_ENV
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ env.package_file }}
path: pkg/${{ env.package_file }}