-
-
Notifications
You must be signed in to change notification settings - Fork 130
744 lines (725 loc) · 32.2 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
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
name: CI
on:
merge_group:
pull_request:
push:
branches:
- main
- rolling-release-*
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_details:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.build_details.outputs.branch }}
sha: ${{ steps.build_details.outputs.sha }}
is_release: ${{ steps.build_details.outputs.is_release }}
is_rolling_release: ${{ steps.build_details.outputs.is_rolling_release }}
is_fork: ${{ steps.build_details.outputs.is_fork }}
build_os: ${{ steps.build_details.outputs.build_os }}
build_platform: ${{ steps.build_details.outputs.build_platform }}
build_include: ${{ steps.build_details.outputs.build_include }}
docker_release: ${{ steps.build_details.outputs.docker_release }}
s3-artifact-basepath: ${{ steps.build_details.outputs.s3-artifact-basepath }}
minimal_exclude_deps: ${{ steps.build_details.outputs.minimal_exclude_deps }}
save_traces: ${{ steps.build_details.outputs.save_traces }}
is_snapshot: ${{ steps.build_details.outputs.is_snapshot }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get build details
env:
IS_FORK: ${{ github.event.pull_request.head.repo.fork == true }}
run: .github/scripts/build-details.sh
id: build_details
build_no_depopts:
runs-on: ubuntu-latest
needs: build_details
container:
image: savonet/liquidsoap-ci:debian_bookworm_amd64
options: --user opam
env:
HOME: /home/opam
steps:
- name: Get number of CPU cores
uses: savonet/github-actions-cpu-cores-docker@v1
id: cpu_cores
- name: Checkout code
run: |
cd /tmp/liquidsoap-full/liquidsoap
git remote set-url origin https://github.com/savonet/liquidsoap.git
git fetch origin ${{ github.sha }}
git checkout ${{ github.sha }}
- name: Install pandoc
run: |
cd /tmp
git clone https://github.com/smimram/ocaml-pandoc.git
opam pin -y add ocaml-pandoc
- name: Build
run: |
echo "::group::Preparing build"
cd /tmp/liquidsoap-full
git remote set-url origin https://github.com/savonet/liquidsoap-full.git
git fetch --recurse-submodules=no
git checkout origin/master -- Makefile.git
make public
git reset --hard
git submodule foreach 'git reset --hard'
git pull
cp PACKAGES.minimal PACKAGES
opam update
opam pin -yn .
opam install -y saturn_lockfree.0.4.1 ppx_hash
opam info -f "depopts:" liquidsoap-core | grep -v osx-secure-transport | xargs opam remove -y inotify ffmpeg-avutil cohttp-lwt-unix prometheus-app ${{ needs.build_details.outputs.minimal_exclude_deps }}
opam install -y mem_usage
echo "::endgroup::"
cd liquidsoap
./.github/scripts/build-posix.sh "${{ steps.cpu_cores.outputs.count }}"
env:
LIQ_BUILD_MIN: true
- name: Build doc
run: |
cd /tmp/liquidsoap-full/liquidsoap
./.github/scripts/build-doc.sh
build_js:
runs-on: ubuntu-latest
container:
image: savonet/liquidsoap-ci:debian_bookworm_amd64
options: --user opam
env:
HOME: /home/opam
steps:
- name: Checkout code
run: |
cd /tmp/liquidsoap-full/liquidsoap
git remote set-url origin https://github.com/savonet/liquidsoap.git
git fetch origin ${{ github.sha }}
git checkout ${{ github.sha }}
mv .git /tmp
rm -rf ./*
mv /tmp/.git .
git reset --hard
- name: Build JS
run: |
cd /tmp/liquidsoap-full/liquidsoap
eval "$(opam config env)"
opam update
opam install -y saturn_lockfree.0.4.1
dune build --profile release ./src/js/interactive_js.bc.js
tree_sitter_parse:
runs-on: ubuntu-latest
needs: build_details
steps:
- name: Checkout latest code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: latest
- name: Parse using tree-sitter
run: |
git clone https://github.com/savonet/tree-sitter-liquidsoap.git
cd tree-sitter-liquidsoap
npm install
npm exec tree-sitter -- parse -q -s ../../**/*.liq
lezer_parse:
runs-on: ubuntu-latest
needs: build_details
steps:
- name: Checkout latest code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: latest
- name: Parse using liquidsoap-lezer-print-tree
run: |
# This one has unicode variable name that isn't supported yet.
rm -rf src/libs/list.liq
git clone https://github.com/savonet/codemirror-lang-liquidsoap.git
cd codemirror-lang-liquidsoap
npm install
npm exec liquidsoap-lezer-print-tree -- -q ../../**/*.liq
update_doc:
runs-on: ubuntu-latest
needs: build_details
if: github.event_name != 'pull_request' && github.repository_owner == 'savonet' && needs.build_details.outputs.branch == 'main'
container:
image: savonet/liquidsoap-ci:debian_bookworm_amd64
options: --user root -v ${{ github.workspace }}/${{ github.run_number }}:/tmp/${{ github.run_number }}
env:
HOME: /home/opam
steps:
- name: Get number of CPU cores
uses: savonet/github-actions-cpu-cores-docker@v1
id: cpu_cores
- name: Checkout code
run: |
cd /tmp/liquidsoap-full/liquidsoap
rm -rf doc/content/build.md doc/content/install.md
sudo -u opam -E git remote set-url origin https://github.com/savonet/liquidsoap.git
sudo -u opam -E git fetch origin ${{ github.sha }}
sudo -u opam -E git checkout ${{ github.sha }}
- name: Install node
run: |
apt-get update
apt-get install -y npm
- name: Install pandoc
run: |
cd /tmp
sudo -u opam -E git clone https://github.com/smimram/ocaml-pandoc.git
sudo -u opam -E opam pin -y add ocaml-pandoc
- name: Build doc
env:
CPU_CORES: ${{ steps.cpu_cores.outputs.count }}
run: |
cd /tmp/liquidsoap-full/liquidsoap
# TMP
sudo -u opam -E ./.github/scripts/add-local-opam-packages.sh
sudo -u opam -E ./.github/scripts/build-posix.sh "${{ steps.cpu_cores.outputs.count }}"
cd /tmp/liquidsoap-full/liquidsoap/
eval $(opam config env)
dune build src/js
cd /tmp/liquidsoap-full/website
make dist
mkdir -p /tmp/${{ github.run_number }}/html
cp -rf html/* /tmp/${{ github.run_number }}/html
- name: Push content
if: success() && github.repository_owner == 'savonet'
uses: crazy-max/ghaction-github-pages@v4
with:
repo: savonet/savonet.github.io
target_branch: master
build_dir: ${{ github.run_number }}/html
fqdn: www.liquidsoap.info
env:
GH_PAT: ${{ secrets.WEBSITE_TOKEN }}
run_tests:
runs-on: ubuntu-latest
needs: build_details
container:
image: savonet/liquidsoap-ci:debian_bookworm_amd64
options: --user root --privileged --ulimit core=-1 --security-opt seccomp=unconfined -v ${{ github.workspace }}/${{ github.run_number }}:/tmp/${{ github.run_number }}
strategy:
fail-fast: false
matrix:
target: ["@citest", "@doctest", "@mediatest"]
env:
HOME: /home/opam
steps:
- name: Get number of CPU cores
uses: savonet/github-actions-cpu-cores-docker@v1
id: cpu_cores
- name: Enable core dump
run: |
ulimit -c unlimited
mkdir -p /tmp/${{ github.run_number }}/core
chown -R opam /tmp/${{ github.run_number }}/core
echo /tmp/${{ github.run_number }}/core/core.%h.%e.%t > /proc/sys/kernel/core_pattern
- name: Checkout code
run: |
cd /tmp/liquidsoap-full/liquidsoap
rm -rf doc/content/build.md doc/content/install.md
sudo -u opam -E git remote set-url origin https://github.com/savonet/liquidsoap.git
sudo -u opam -E git fetch origin ${{ github.sha }}
sudo -u opam -E git checkout ${{ github.sha }}
- name: Install sqlite
run: |
sudo apt-get -y update
sudo apt-get -y install libsqlite3-dev
sudo -u opam -E opam install -y sqlite3
- name: Install pandoc
run: |
cd /tmp
if [ ! -d ocaml-pandoc ]; then
mkdir -p ocaml-pandoc;
chown -R opam ocaml-pandoc;
sudo -u opam -E git clone https://github.com/smimram/ocaml-pandoc.git ocaml-pandoc
fi
sudo -u opam -E opam pin -y add ocaml-pandoc
- name: Build
env:
CPU_CORES: ${{ steps.cpu_cores.outputs.count }}
run: |
cd /tmp/liquidsoap-full/liquidsoap
# TMP
sudo -u opam -E ./.github/scripts/add-local-opam-packages.sh
sudo -u opam -E ./.github/scripts/build-posix.sh "${{ steps.cpu_cores.outputs.count }}"
cp /tmp/liquidsoap-full/liquidsoap/_build/default/src/bin/liquidsoap.exe /tmp/${{ github.run_number }}/core/liquidsoap
- name: Compute stats
run: |
cd /tmp/liquidsoap-full/liquidsoap
sudo -u opam -E ./.github/scripts/stats-posix.sh
- name: Install additional packages
if: matrix.target == '@doctest'
run: |
apt-get -y update
apt-get -y install frei0r-plugins
sudo -u opam -E opam install -y prometheus-liquidsoap
- name: Run tests
env:
CPU_CORES: ${{ steps.cpu_cores.outputs.count }}
run: |
cd /tmp/liquidsoap-full/liquidsoap
sudo -u opam -E ./.github/scripts/test-posix.sh ${{ matrix.target }}
- name: Finalize metrics
run: |
cd /tmp/liquidsoap-full/liquidsoap
mkdir -p "/tmp/${{ github.run_number }}/metrics"
chown -R opam "/tmp/${{ github.run_number }}/metrics"
sudo -u opam -E ./.github/scripts/export-metrics.sh "${{ needs.build_details.outputs.branch }}" "/tmp/${{ github.run_number }}/metrics"
- name: Upload metrics artifact
uses: actions/upload-artifact@v4
if: needs.build_details.outputs.is_fork != 'true' && matrix.target == '@citest'
with:
name: metrics
path: ${{ github.workspace }}/${{ github.run_number }}/metrics
- name: Upload metrics
if: needs.build_details.outputs.is_fork != 'true' && matrix.target == '@citest'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: metrics
publish_dir: ${{ github.workspace }}/${{ github.run_number }}/metrics
keep_files: true
- name: Save traces
if: (success() || failure()) && ${{ needs.build_details.outputs.save_traces == 'true' }}
run: |
mkdir -p /tmp/${{ github.run_number }}/traces/${{ matrix.target }}
cd /tmp/liquidsoap-full/liquidsoap
find _build/default/tests | grep '\.trace$' | while read i; do mv "$i" /tmp/${{ github.run_number }}/traces/${{ matrix.target }}; done
- name: Upload traces
if: (success() || failure()) && ${{ needs.build_details.outputs.save_traces == 'true' }}
uses: actions/upload-artifact@v4
with:
name: traces-${{ matrix.target }}
path: ${{ github.workspace }}/${{ github.run_number }}/traces/${{ matrix.target }}
- name: Export potential core dumps
uses: actions/upload-artifact@v4
if: failure()
with:
name: core-dump-${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.target }}
path: ${{ github.workspace }}/${{ github.run_number }}/core
- name: Cleanup
if: ${{ always() }}
run: |
rm -rf /tmp/${{ github.run_number }}/core
build_opam:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ocaml-compiler:
- 4.14.x
- 5.2.x
steps:
- name: Checkout latest code
uses: actions/checkout@v3
- name: Update packages
run: |
sudo apt-get update
- name: Setup OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-pin: false
opam-depext: false
- name: Add local packages
run: |
./.github/scripts/add-local-opam-packages.sh
- name: Install liquidsoap
run: |
opam install --cli=2.1 --confirm-level=unsafe-yes .
- name: Install ocamlformat
if: matrix.ocaml-compiler == '4.14.x'
run: |
opam install ocamlformat=0.25.1
- name: Set PY env variable.
if: matrix.ocaml-compiler == '4.14.x'
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Restore pre-commit cache
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
if: matrix.ocaml-compiler == '4.14.x'
uses: pre-commit/[email protected]
build_posix:
runs-on: ${{ matrix.runs-on }}
needs: build_details
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.build_details.outputs.build_os) }}
platform: ${{ fromJson(needs.build_details.outputs.build_platform) }}
include: ${{ fromJson(needs.build_details.outputs.build_include) }}
container:
image: savonet/liquidsoap-ci:${{ matrix.os }}_${{ matrix.platform }}
options: --user root --privileged -v ${{ github.workspace }}/${{ github.run_number }}:/tmp/${{ github.run_number }}
env:
HOME: /home/opam
IS_SNAPSHOT: ${{ needs.build_details.outputs.is_snapshot == 'true' }}
steps:
- name: Get number of CPU cores
uses: savonet/github-actions-cpu-cores-docker@v1
id: cpu_cores
- name: Checkout code
run: |
cd /tmp/liquidsoap-full/liquidsoap
rm -rf doc/content/build.md doc/content/install.md
sudo -u opam -E git remote set-url origin https://github.com/savonet/liquidsoap.git
sudo -u opam -E git fetch origin ${{ github.sha }}
sudo -u opam -E git checkout ${{ github.sha }}
- name: Update debian packages
if: contains(matrix.os, 'debian') || contains(matrix.os, 'ubuntu')
run: |
echo "opam hold" | sudo dpkg --set-selections
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
sudo apt-get -y install libsqlite3-dev
- name: Update alpine packages
if: matrix.os == 'alpine'
run: |
apk -U --force-overwrite upgrade
apk add -i sqlite-dev
- name: Install additional libraries
run: |
sudo -u opam -E opam install -y sqlite3
- name: Install pandoc
run: |
cd /tmp
sudo -u opam -E git clone https://github.com/smimram/ocaml-pandoc.git ocaml-pandoc
sudo -u opam -E opam pin -y add ocaml-pandoc
- name: Build
run: |
cd /tmp/liquidsoap-full/liquidsoap
export CPU_CORES=${{ steps.cpu_cores.outputs.count }}
# TMP
sudo -u opam -E ./.github/scripts/add-local-opam-packages.sh
sudo -u opam -E ./.github/scripts/build-posix.sh "${{ steps.cpu_cores.outputs.count }}"
- name: Build doc
if: contains(matrix.os, 'debian') || contains(matrix.os, 'ubuntu')
run: |
cd /tmp/liquidsoap-full/liquidsoap
sudo -u opam -E ./.github/scripts/build-doc.sh
- name: Build debian package
if: contains(matrix.os, 'debian') || contains(matrix.os, 'ubuntu')
id: build_deb
run: |
mkdir -p /tmp/${{ github.run_number }}/${{ matrix.os }}_${{ matrix.platform }}/debian
chown -R opam /tmp/${{ github.run_number }}/${{ matrix.os }}_${{ matrix.platform }}/debian
chown -R opam "${GITHUB_OUTPUT}"
cd /tmp/liquidsoap-full/liquidsoap
sudo -u opam -E ./.github/scripts/build-deb.sh ${{ github.sha }} ${{ needs.build_details.outputs.branch }} ${{ matrix.os }} ${{ matrix.platform }} "${{ needs.build_details.outputs.is_rolling_release }}" "${{ needs.build_details.outputs.is_release }}" "${{ needs.build_details.outputs.minimal_exclude_deps }}"
- name: Upload debian packages artifacts
if: (contains(matrix.os, 'debian') || contains(matrix.os, 'ubuntu'))
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build_deb.outputs.basename }}
path: ${{ github.workspace }}/${{ github.run_number }}/${{ matrix.os }}_${{ matrix.platform }}/debian
if-no-files-found: error
- name: Build alpine package
if: matrix.os == 'alpine'
id: build_apk
run: |
cd /tmp/liquidsoap-full/liquidsoap
apk add alpine-sdk
adduser opam abuild
mkdir -p /tmp/${{ github.run_number }}/${{ matrix.os }}_${{ matrix.platform }}/alpine
chown -R opam /tmp/${{ github.run_number }}/${{ matrix.os }}_${{ matrix.platform }}/alpine
chown -R opam "${GITHUB_OUTPUT}"
sudo -u opam -E ./.github/scripts/build-apk.sh ${{ needs.build_details.outputs.branch }} ${{ matrix.os }} ${{ matrix.platform }} ${{ matrix.alpine-arch }} "${{ needs.build_details.outputs.is_rolling_release }}" "${{ needs.build_details.outputs.is_release }}" "${{ needs.build_details.outputs.minimal_exclude_deps }}"
- name: Upload alpine packages artifacts
if: needs.build_details.outputs.is_fork != 'true' && matrix.os == 'alpine'
uses: savonet/aws-s3-docker-action@master
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE: ${{ github.workspace }}/${{ github.run_number }}/${{ matrix.os }}_${{ matrix.platform }}/alpine
TARGET: ${{ needs.build_details.outputs.s3-artifact-basepath }}
- name: Cleanup
if: ${{ always() }}
run: |
rm -rf /tmp/${{ github.run_number }}/${{ matrix.os }}_${{ matrix.platform }}
fetch_s3_artifacts:
runs-on: ubuntu-latest
needs: [build_details, build_posix]
steps:
- name: Prepare directory
run: |
rm -rf ${{ github.workspace }}/${{ github.run_number }}/s3-artifacts
mkdir -p ${{ github.workspace }}/${{ github.run_number }}/s3-artifacts
- name: Fetch S3 artifacts
if: needs.build_details.outputs.is_fork != 'true'
uses: savonet/aws-s3-docker-action@master
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE: ${{ needs.build_details.outputs.s3-artifact-basepath }}
TARGET: ${{ github.workspace }}/${{ github.run_number }}/s3-artifacts
- name: Upload S3 artifacts
uses: actions/upload-artifact@v4
if: needs.build_details.outputs.is_fork != 'true'
with:
name: alpine-packages
path: ${{ github.workspace }}/${{ github.run_number }}/s3-artifacts
build_win32:
runs-on: ubuntu-latest
needs: build_details
strategy:
fail-fast: false
matrix:
system: [x64]
container:
image: savonet/liquidsoap-win32-deps-${{ matrix.system }}
options: --user root -v ${{ github.workspace }}/${{ github.run_number }}:/tmp/${{ github.run_number }}
env:
OPAM_DEPS: ao-windows,lastfm-windows,camomile-windows,cry-windows,dtools-windows,duppy-windows,ffmpeg-windows,ffmpeg-avutil-windows,mm-windows,re-windows,portaudio-windows,samplerate-windows,sedlex-windows,ssl-windows,srt-windows,winsvc-windows,mem_usage-windows
IS_SNAPSHOT: ${{ needs.build_details.outputs.is_snapshot == 'true' }}
TOOLPREF64: /usr/src/mxe/usr/bin/x86_64-w64-mingw32.static-
steps:
- name: Get number of CPU cores
uses: savonet/github-actions-cpu-cores-docker@v1
id: cpu_cores
- name: Checkout code
run: |
mkdir -p /tmp/${{ github.run_number }}/win32/liquidsoap
cd /tmp/${{ github.run_number }}/win32/liquidsoap
git init
git remote add origin https://github.com/${{ github.repository }}.git
git fetch origin ${{ github.sha }}
git checkout ${{ github.sha }}
chown -R opam /tmp/${{ github.run_number }}/win32
- name: Add local packages
run: |
cd /tmp/${{ github.run_number }}/win32/liquidsoap/
gosu opam:root ./.github/scripts/add-local-opam-packages.sh
- name: Build windows binary
run: |
mkdir -p /tmp/${{ github.run_number }}/win32/dist
chown -R opam /tmp/${{ github.run_number }}/win32/dist
chown -R opam "${GITHUB_OUTPUT}"
cd /tmp/${{ github.run_number }}/win32/liquidsoap
gosu opam:root ./.github/scripts/build-win32.sh ${{ matrix.system }} ${{ needs.build_details.outputs.branch }} "${{ steps.cpu_cores.outputs.count }}" "${{ needs.build_details.outputs.is_rolling_release }}" "${{ needs.build_details.outputs.is_release }}" ${{ github.sha }}
id: build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.basename }}
path: ${{ github.workspace }}/${{ github.run_number }}/win32/dist
if-no-files-found: error
- name: Cleanup
if: ${{ always() }}
run: |
rm -rf /tmp/${{ github.run_number }}/win32
update_release:
runs-on: ubuntu-latest
needs:
[
build_details,
build_no_depopts,
build_js,
run_tests,
build_posix,
build_win32,
fetch_s3_artifacts,
]
if: needs.build_details.outputs.is_release
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Tag commit
uses: savonet/latest-tag@any-context
with:
description: Liquidsoap ${{ needs.build_details.outputs.branch }}
tag-name: ${{ needs.build_details.outputs.branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download all artifact
uses: actions/download-artifact@v4
with:
path: artifacts/${{ needs.build_details.outputs.sha }}
- name: List assets to upload
run: |
echo "RELEASE_ASSETS<<EOF" >> $GITHUB_ENV
find artifacts/${{ needs.build_details.outputs.sha }} -type f | egrep '\.apk$|\.deb$|\.config|\.zip$' | sort -u >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Generate release notes
run: |
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
if [ ${{ needs.build_details.outputs.is_rolling_release }} = "true" ]; then
cat doc/content/rolling-release.md >> $GITHUB_ENV
fi
echo "EOF" >> $GITHUB_ENV
- name: Generate changelog
run: |
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
cat CHANGES.md | sed -e "/---/,\$d" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Delete old release assets
uses: mknejp/delete-release-assets@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.build_details.outputs.branch }}
assets: "*"
fail-if-no-release: false
fail-if-no-assets: false
- name: Upload assets to main repo release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.build_details.outputs.branch }}
files: ${{ env.RELEASE_ASSETS }}
prerelease: ${{ needs.build_details.outputs.is_rolling_release }}
body: "${{ env.RELEASE_NOTES}}\n\n${{ env.CHANGELOG }}"
draft: true
- name: Upload assets to release repo
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIQUIDSOAP_RELEASE_ASSETS_TOKEN }}
tag_name: ${{ needs.build_details.outputs.branch }}
files: ${{ env.RELEASE_ASSETS }}
repository: savonet/liquidsoap-release-assets
prerelease: ${{ needs.build_details.outputs.is_rolling_release }}
body_path: doc/content/release-assets.md
draft: true
build_docker:
runs-on: ${{ matrix.runs-on }}
needs: [build_details, build_posix, fetch_s3_artifacts]
if: needs.build_details.outputs.is_fork != 'true' && github.event_name != 'merge_group'
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.build_details.outputs.build_platform) }}
include: ${{ fromJson(needs.build_details.outputs.build_include) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download all artifact
uses: actions/download-artifact@v4
with:
path: artifacts/${{ needs.build_details.outputs.sha }}
- name: Get debian package
run: |
echo "deb-file=$(find artifacts/${{ needs.build_details.outputs.sha }} -type f | grep ${{ matrix.docker-debian-os }} | grep -v minimal | grep '${{ matrix.platform }}\.deb$' | grep -v dbgsym | grep deb)" >> "${GITHUB_OUTPUT}"
id: debian_package
- name: Get debian debug package
run: |
echo "deb-file=$(find artifacts/${{ needs.build_details.outputs.sha }} -type f | grep ${{ matrix.docker-debian-os }} | grep -v minimal | grep '${{ matrix.platform }}\.deb$' | grep dbgsym | grep deb)" >> "${GITHUB_OUTPUT}"
id: debian_debug_package
- name: Log in to the github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build docker image
run: .github/scripts/build-docker.sh ${{ steps.debian_package.outputs.deb-file }} ${{ steps.debian_debug_package.outputs.deb-file }} ${{ needs.build_details.outputs.branch }} ${{ secrets.DOCKERHUB_USER }} ${{ secrets.DOCKERHUB_PASSWORD }} ${{ matrix.platform }} ${{ matrix.docker-platform }}
build_docker_alpine:
runs-on: ${{ matrix.runs-on }}
needs: [build_details, run_tests, build_posix, fetch_s3_artifacts]
if: needs.build_details.outputs.is_fork != 'true' && github.event_name != 'merge_group'
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.build_details.outputs.build_platform) }}
include: ${{ fromJson(needs.build_details.outputs.build_include) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download all artifact
uses: actions/download-artifact@v4
with:
path: artifacts/${{ needs.build_details.outputs.sha }}
- name: Get alpine package
run: |
echo "apk-file=$(find artifacts/${{ needs.build_details.outputs.sha }} -type f | grep -v minimal | grep 'apk$' | grep -v dbg | grep ${{ matrix.alpine-arch }})" >> "${GITHUB_OUTPUT}"
id: alpine_package
- name: Log in to the github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build docker image
run: .github/scripts/build-docker-alpine.sh ${{ steps.alpine_package.outputs.apk-file }} ${{ needs.build_details.outputs.branch }} ${{ secrets.DOCKERHUB_USER }} ${{ secrets.DOCKERHUB_PASSWORD }} ${{ matrix.platform }} ${{ matrix.docker-platform }}
build_docker_minimal:
runs-on: ${{ matrix.runs-on }}
needs: [build_details, run_tests, build_posix, fetch_s3_artifacts]
if: needs.build_details.outputs.is_fork != 'true' && github.event_name != 'merge_group'
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.build_details.outputs.build_platform) }}
include: ${{ fromJson(needs.build_details.outputs.build_include) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download all artifact
uses: actions/download-artifact@v4
with:
path: artifacts/${{ needs.build_details.outputs.sha }}
- name: Get debian package
run: |
echo "deb-file=$(find artifacts/${{ needs.build_details.outputs.sha }} -type f | grep ${{ matrix.docker-debian-os }} | grep minimal | grep '${{ matrix.platform }}\.deb$' | grep -v dbgsym | grep deb)" >> "${GITHUB_OUTPUT}"
id: debian_package
- name: Get debian debug package
run: |
echo "deb-file=$(find artifacts/${{ needs.build_details.outputs.sha }} -type f | grep ${{ matrix.docker-debian-os }} | grep minimal | grep '${{ matrix.platform }}\.deb$' | grep dbgsym | grep deb)" >> "${GITHUB_OUTPUT}"
id: debian_debug_package
- name: Log in to the github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build docker image
run: .github/scripts/build-docker.sh ${{ steps.debian_package.outputs.deb-file }} ${{ steps.debian_debug_package.outputs.deb-file }} ${{ needs.build_details.outputs.branch }}-minimal ${{ secrets.DOCKERHUB_USER }} ${{ secrets.DOCKERHUB_PASSWORD }} ${{ matrix.platform }} ${{ matrix.docker-platform }}
build_docker_alpine_minimal:
runs-on: ${{ matrix.runs-on }}
needs: [build_details, run_tests, build_posix, fetch_s3_artifacts]
if: needs.build_details.outputs.is_fork != 'true' && github.event_name != 'merge_group'
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.build_details.outputs.build_platform) }}
include: ${{ fromJson(needs.build_details.outputs.build_include) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download all artifact
uses: actions/download-artifact@v4
with:
path: artifacts/${{ needs.build_details.outputs.sha }}
- name: Get alpine package
run: |
echo "apk-file=$(find artifacts/${{ needs.build_details.outputs.sha }} -type f | grep minimal | grep 'apk$' | grep -v dbg | grep ${{ matrix.alpine-arch }})" >> "${GITHUB_OUTPUT}"
id: alpine_package
- name: Get alpine debug package
run: |
echo "apk-file=$(find artifacts/${{ needs.build_details.outputs.sha }} -type f | grep minimal | grep 'apk$' | grep dbg | grep ${{ matrix.alpine-arch }})" >> "${GITHUB_OUTPUT}"
id: alpine_dbg_package
- name: Log in to the github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build docker image
run: .github/scripts/build-docker-alpine.sh ${{ steps.alpine_package.outputs.apk-file }} ${{ steps.alpine_dbg_package.outputs.apk-file }} ${{ needs.build_details.outputs.branch }}-minimal ${{ secrets.DOCKERHUB_USER }} ${{ secrets.DOCKERHUB_PASSWORD }} ${{ matrix.platform }} ${{ matrix.docker-platform }}
build_docker_release:
runs-on: ubuntu-latest
needs: [build_details, run_tests, build_docker, build_docker_alpine]
if: needs.build_details.outputs.docker_release
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Push consolidated manifest
run: .github/scripts/push-docker.sh ${{ needs.build_details.outputs.branch }} ${{ secrets.DOCKERHUB_USER }} ${{ secrets.DOCKERHUB_PASSWORD }} ${{ github.actor }} ${{ secrets.GITHUB_TOKEN }} ${{ github.sha }}
build_docker_release-minimal:
runs-on: ubuntu-latest
needs: [build_details, build_docker_minimal, build_docker_alpine_minimal]
if: needs.build_details.outputs.docker_release
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Push consolidated manifest
run: .github/scripts/push-docker.sh ${{ needs.build_details.outputs.branch }}-minimal ${{ secrets.DOCKERHUB_USER }} ${{ secrets.DOCKERHUB_PASSWORD }} ${{ github.actor }} ${{ secrets.GITHUB_TOKEN }} ${{ github.sha }}-minimal