-
-
Notifications
You must be signed in to change notification settings - Fork 53
698 lines (606 loc) · 24.5 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
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
---
name: CI
on: [ push, pull_request ]
env:
pcre2: pcre2-10.40
wc: wc
seeds: seeds
build: build
cvtpcre: build/test/retest
prefix: prefix
maintainer: [email protected]
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-AUSAN-${{ 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-AUSAN-${{ 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, AUSAN, MSAN, EFENCE, FUZZER ] # NO_SANITIZER=1 is a no-op
os: [ ubuntu ]
cc: [ clang, gcc ]
make: [ bmake ] # we test makefiles separately
debug: [ DEBUG, 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
- san: FUZZER
cc: gcc # -fsanitize=fuzzer is clang-only
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: matrix.san != 'FUZZER' && 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
# We aren't building the CLI executables here, just the fuzzer
# matrix.san=FUZZER implies UBSAN and ASAN (but not MSAN, MSAN is incompatible with ASAN)
# XXX: needing to explicitly mkdir here is a makefile bug
- name: Make (Fuzzer)
if: matrix.san == 'FUZZER' && 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 AUSAN=1 PKGCONF=pkg-config CC=${{ matrix.cc }} NODOC=1 mkdir
${{ matrix.make }} -r -j $((${{ steps.cpu-cores.outputs.count }} + 1)) -C ${{ env.wc }} BUILD=../${{ env.build }} ${{ matrix.san }}=1 ${{ matrix.debug }}=1 AUSAN=1 PKGCONF=pkg-config CC=${{ matrix.cc }} NODOC=1 fuzz
# 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
#
# I'm including EXPENSIVE_CHECKS here just so we have some coverage
# of the build during CI, even if we don't run that during tests.
test_makefiles:
name: "Test (Makefiles) ${{ matrix.make }} ${{ matrix.os }} ${{ matrix.debug }}"
runs-on: ${{ matrix.os }}-latest
needs: [ checkout, build ]
strategy:
fail-fast: false
matrix:
san: [ NO_SANITIZER ] # NO_SANITIZER=1 is a no-op
os: [ ubuntu ]
cc: [ clang ]
make: [ bmake, pmake ]
debug: [ EXPENSIVE_CHECKS, 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 }}
# An arbitary build.
- 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 }}
# We don't need to build the entire repo to know that the makefiles work,
# I'm just deleting a couple of .o files and rebuilding those instead.
- name: Delete something
if: steps.cache-build.outputs.cache-hit == 'true'
run: find ${{ env.build }} -type f -name '*.o' | sort -r | head -5 | xargs rm
- name: Outdate something
if: steps.cache-build.outputs.cache-hit == 'true'
run: find ${{ env.wc }} -type f -name '*.c' | sort -r | head -5 | xargs touch
- 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
# there's an unfixed intermittent makefile bug under -j for
# kmkf duplicate install targets, it's not interesting for libfsm's CI,
# so I'm retrying on error here. # github.com/katef/kmkf/issues/14
- name: Install
uses: nick-fields/[email protected]
with:
timeout_seconds: 10 # required, but not a problem for the kmkf bug
max_attempts: 3
retry_on: error
command: ${{ 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: [ AUSAN, MSAN, EFENCE ]
os: [ ubuntu ]
cc: [ clang, gcc ]
make: [ bmake ]
debug: [ DEBUG, 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_fuzz:
name: "Fuzz (mode ${{ matrix.mode }}) ${{ matrix.cc }} ${{ matrix.os }} ${{ matrix.debug }}"
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 5 # this should never be reached, it's a safeguard for bugs in the fuzzer itself
needs: [ build ]
strategy:
fail-fast: false
matrix:
san: [ FUZZER ]
os: [ ubuntu ]
cc: [ clang ]
make: [ bmake ]
debug: [ DEBUG, RELEASE ] # RELEASE=1 is a no-op
mode: [ m, p, d ]
exclude:
- os: macos
cc: gcc # it's clang anyway
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
${{ matrix.cc }} --version
- name: Dependencies (MacOS)
if: matrix.os == 'macos'
run: |
uname -a
brew update
brew install bmake
${{ 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 }}
# note we do the fuzzing unconditionally; each run adds to the corpus.
#
# We only run fuzzing for PRs in the base repo, this prevents attempting
# to purge the seed cache from a PR syncing a forked repo, which fails
# due to a permissions error (I'm unsure why, I think PRs from clones can't
# purge a cache in CI presumably for security/DoS reasons). PRs from clones
# still run fuzzing, just from empty, and do not save their seeds.
- name: Restore seeds (mode ${{ matrix.mode }})
if: github.repository == 'katef/libfsm'
uses: actions/cache/restore@v3
id: cache-seeds
with:
path: ${{ env.seeds }}-${{ matrix.mode }}
key: seeds-${{ matrix.mode }}-${{ matrix.debug }}
- name: mkdir seeds
if: steps.cache-seeds.outputs.cache-hit != 'true'
run: mkdir -p ${{ env.seeds }}-${{ matrix.mode }}
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Fuzz
env:
MODE: ${{ env.mode }}
UBSAN_OPTIONS: ASAN_OPTIONS=detect_leaks=0:halt_on_error=1 UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
run: ./${{ env.build }}/fuzz/fuzzer -fork=$((${{ steps.cpu-cores.outputs.count }} + 1)) -max_total_time=60 ${{ env.seeds }}-${{ matrix.mode }}
# saving the cache would fail because this key already exists,
# so I'm just explicitly purging by key here.
# the key contains "-${{ matrix.debug }}" so we don't lose seeds
# found from another instance in the matrix when purging.
- name: Purge cached seeds (mode ${{ matrix.mode }}-${{ matrix.debug }})
if: steps.cache-seeds.outputs.cache-hit == 'true'
run: |
set +e
gh extension install actions/gh-actions-cache
gh actions-cache delete ${{ steps.cache-seeds.outputs.cache-primary-key }} -R ${{ github.repository }} --confirm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# if: always() means we keep these even on error, so we don't need to re-find
# the same seeds for a given bug.
# The explicit cache/restore and cache/save actions are just for that.
- name: Save seeds (mode ${{ matrix.mode }}-${{ matrix.debug }})
uses: actions/cache/save@v3
if: always()
with:
path: ${{ env.seeds }}-${{ matrix.mode }}
key: ${{ steps.cache-seeds.outputs.cache-primary-key }}
# nothing to do with the caching, I'm uploading the seeds so a developer can grab them to fuzz locally
- name: Upload seeds (mode ${{ matrix.mode }}-${{ matrix.debug }})
uses: actions/upload-artifact@v3
with:
name: seeds-${{ matrix.mode }}-${{ matrix.debug }}
path: ${{ env.seeds }}-${{ matrix.mode }}
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: [ AUSAN, MSAN, EFENCE ]
os: [ ubuntu ]
cc: [ clang, gcc ]
make: [ bmake ]
debug: [ DEBUG, RELEASE ] # RELEASE=1 is a no-op
lang: [ "vm -x v1", "vm -x v2", asm, c, rust, vmc, vmops, go, goasm, llvm ]
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: Dependencies (Ubuntu/Go)
if: matrix.os == 'ubuntu' && (matrix.lang == 'go' || matrix.lang == 'goasm')
run: |
uname -a
sudo apt-get install golang
go 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-AUSAN-${{ 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 }}