Repository navigation
921 lines (826 loc) · 31.8 KB
/
Copy pathrtpproxy_ci.yml
File metadata and controls
921 lines (826 loc) · 31.8 KB
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
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
name: RTPProxy CI
# Controls when the action will run.
on:
# Triggers the workflow on all push or pull request events
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"
permissions:
contents: write
# Cancels previous runs of this workflow for the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || startsWith(github.ref_name, 'codex/') || github.ref_name == 'wip' }}
env:
COVERALLS_REPORTER_VERSION: v0.6.22
jobs:
LoadJobs_conf:
name: Load Jobs Settings
uses: ./.github/workflows/.jobs_configure.yml
MinBuild:
name: Lean Build
needs: LoadJobs_conf
if: needs.LoadJobs_conf.outputs.do_MinBuild == 'true'
# The type of runner that the job will run on
runs-on: ubuntu-latest
container:
image: ubuntu:${{ matrix.os }}
options: >-
-v sources:/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
--sysctl net.ipv4.ip_unprivileged_port_start=1024 --init
env:
COMPILER: ${{ matrix.compiler }}
TAR_CMD: tar
GHA_OS: ubuntu-${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_MinBuild) }}
steps:
- name: Install git
run: |
apt-get update
apt-get install -y git lsb-release gnupg2 wget
- uses: actions/checkout@v7
with:
submodules: 'recursive'
- name: Start Docker container
if: endsWith(matrix.compiler, '-cross')
run: sh -x scripts/build/start_container.sh
- name: Cache apt-get packages
uses: actions/cache@v6
with:
path: /var/cache/apt/archives
key: cleanbuild-${{ matrix.os }}-apt-get-${{ github.run_id }}
restore-keys: |
cleanbuild-${{ matrix.os }}-apt-get
cleanbuild-${{ matrix.os }}-${{ matrix.compiler }}-apt-get
- name: Install apt-get updates
run: scripts/ft-apt-get-update.sh
- name: install_depends
run: sh -x scripts/build/install_depends.sh
- name: build
run: sh -x ./scripts/do-build.sh cleanbuild
BuildPackages:
name: Build Packages
needs: [LoadJobs_conf, FullBuild]
uses: sippy/cimagic/.github/workflows/BuildDPKGs.yml@v3
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_BuildPackages == 'true' &&
(needs.LoadJobs_conf.outputs.do_FullBuild != 'true' || needs.FullBuild.result == 'success') }}
with:
apt_depends: pkg-config libssl-dev libbcg729-dev libgsm1-dev libsndfile1-dev libunwind-dev libsrtp2-dev libsystemd-dev systemd procps
test_dpkgs_script: ./scripts/do-dpkg-test.sh
os_versions: '["ubuntu:26.04", "ubuntu:24.04", "ubuntu:22.04", "debian:13", "debian:12", "debian:11"]'
FullBuild:
name: Full Build
needs: [LoadJobs_conf, MinBuild]
if: ${{ !cancelled() && (needs.LoadJobs_conf.outputs.do_FullBuild == 'true' ||
needs.LoadJobs_conf.outputs.do_FuncTest == 'true' || needs.LoadJobs_conf.outputs.do_Glitch == 'true') &&
(needs.LoadJobs_conf.outputs.do_MinBuild != 'true' || needs.MinBuild.result == 'success') }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
COMPILER: ${{ matrix.compiler }}
TAR_CMD: tar
GHA_OS: ubuntu-${{ matrix.os }}
CI_IMAGE: ghcr.io/${{ github.repository }}:ci-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.compiler }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_FullBuild) }}
steps:
- uses: actions/checkout@v7
with:
submodules: 'recursive'
persist-credentials: false
- name: Build CI image with both test suites
run: |
docker build --file docker/Dockerfile.ci \
--build-arg BASE_IMAGE=ubuntu:${{ matrix.os }} \
--build-arg COMPILER=${{ matrix.compiler }} \
--label "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \
--tag rtpproxy-ci:tests .
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push CI image
if: github.event_name != 'pull_request'
run: |
docker tag rtpproxy-ci:tests "${CI_IMAGE}"
docker push "${CI_IMAGE}"
- name: Save CI image
if: github.event_name == 'pull_request'
run: |
docker image inspect rtpproxy-ci:tests --format 'Uncompressed CI image size: {{.Size}} bytes'
mkdir -p "${RUNNER_TEMP}/ci-image"
docker save rtpproxy-ci:tests | zstd -T0 -3 -c > "${RUNNER_TEMP}/ci-image/rtpproxy-ci.tar.zst"
du -h "${RUNNER_TEMP}/ci-image/rtpproxy-ci.tar.zst"
# PRs use artifacts so their builds do not need registry write access.
- name: Upload CI image for test jobs
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v7
with:
name: ci-image-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/ci-image/rtpproxy-ci.tar.zst
compression-level: 0
if-no-files-found: error
retention-days: 3
# Stable names also let failed-job reruns reuse an earlier build.
overwrite: true
FuncTest:
name: Functional Testing
needs: [LoadJobs_conf, FullBuild]
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_FuncTest == 'true' &&
needs.FullBuild.result == 'success' }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
env:
COMPILER: ${{ matrix.compiler }}
TAR_CMD: tar
GHA_OS: ubuntu-${{ matrix.os }}
CI_IMAGE: ghcr.io/${{ github.repository }}:ci-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.compiler }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_FuncTest) }}
steps:
- uses: actions/checkout@v7
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull CI image
if: github.event_name != 'pull_request'
run: |
docker pull "${CI_IMAGE}"
docker tag "${CI_IMAGE}" rtpproxy-ci:tests
- name: Download CI image
if: github.event_name == 'pull_request'
uses: actions/download-artifact@v8
with:
name: ci-image-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/ci-image
- name: Load CI image
if: github.event_name == 'pull_request'
run: docker load --input "${RUNNER_TEMP}/ci-image/rtpproxy-ci.tar.zst"
- name: Start CI image
run: |
sudo sysctl -w kernel.core_pattern=core
docker run --detach --name rtpproxy-tests --init \
--sysctl net.ipv4.ip_unprivileged_port_start=1024 \
--workdir /opt/rtpproxy/basic rtpproxy-ci:tests
- name: test
id: tests
run: docker exec rtpproxy-tests sh -x scripts/do-test.sh
- name: Collect coverage
run: |
docker exec rtpproxy-tests sh -x scripts/collect-coverage.sh
docker cp rtpproxy-tests:/opt/rtpproxy/basic/coverage .
sed -i "s|^SF:/opt/rtpproxy/basic/|SF:${GITHUB_WORKSPACE}/|" coverage/lcov.info
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: coverage-functional-${{ matrix.os }}-${{ matrix.compiler }}
path: coverage/lcov.info
overwrite: true
retention-days: 1
- name: Copy test results
if: ${{ always() && steps.tests.outcome != 'skipped' }}
run: docker cp rtpproxy-tests:/opt/rtpproxy/basic/tests/test-suite.log tests/test-suite.log
- name: Collect test summary
id: summary
if: ${{ always() }}
env:
TEST_OUTCOME: ${{ steps.tests.outcome }}
run: python3 scripts/test-summary.py collect --suite functional --output "${RUNNER_TEMP}/test-summary.json"
- name: Upload test summary
if: ${{ always() && steps.summary.outcome == 'success' }}
uses: actions/upload-artifact@v7
with:
name: test-summary-${{ github.run_attempt }}-functional-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/test-summary.json
- name: Remove test container
if: ${{ always() }}
run: docker rm --force rtpproxy-tests 2>/dev/null || true
Glitching:
name: Glitch Injection
needs: [LoadJobs_conf, FullBuild, FuncTest]
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_Glitch == 'true' && needs.FullBuild.result == 'success' &&
(needs.LoadJobs_conf.outputs.do_FuncTest != 'true' || needs.FuncTest.result == 'success') }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
env:
COMPILER: ${{ matrix.compiler }}
TAR_CMD: tar
GHA_OS: ubuntu-${{ matrix.os }}
CI_IMAGE: ghcr.io/${{ github.repository }}:ci-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.compiler }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_Glitching) }}
steps:
- uses: actions/checkout@v7
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull CI image
if: github.event_name != 'pull_request'
run: |
docker pull "${CI_IMAGE}"
docker tag "${CI_IMAGE}" rtpproxy-ci:tests
- name: Download CI image
if: github.event_name == 'pull_request'
uses: actions/download-artifact@v8
with:
name: ci-image-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/ci-image
- name: Load CI image
if: github.event_name == 'pull_request'
run: docker load --input "${RUNNER_TEMP}/ci-image/rtpproxy-ci.tar.zst"
- name: Start CI image
run: |
sudo sysctl -w kernel.core_pattern=core
docker run --detach --name rtpproxy-tests --init \
--sysctl net.ipv4.ip_unprivileged_port_start=1024 \
--security-opt seccomp=unconfined \
--workdir /opt/rtpproxy/glitching rtpproxy-ci:tests
- name: test
id: tests
run: docker exec rtpproxy-tests sh -x scripts/do-test.sh
- name: Collect coverage
run: |
docker exec rtpproxy-tests sh -x scripts/collect-coverage.sh
docker cp rtpproxy-tests:/opt/rtpproxy/glitching/coverage .
sed -i "s|^SF:/opt/rtpproxy/glitching/|SF:${GITHUB_WORKSPACE}/|" coverage/lcov.info
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: coverage-glitching-${{ matrix.os }}-${{ matrix.compiler }}
path: coverage/lcov.info
overwrite: true
retention-days: 1
- name: Copy test results
if: ${{ always() && steps.tests.outcome != 'skipped' }}
run: docker cp rtpproxy-tests:/opt/rtpproxy/glitching/tests/test-suite.log tests/test-suite.log
- name: Collect test summary
id: summary
if: ${{ always() }}
env:
TEST_OUTCOME: ${{ steps.tests.outcome }}
run: python3 scripts/test-summary.py collect --suite glitching --output "${RUNNER_TEMP}/test-summary.json"
- name: Upload test summary
if: ${{ always() && steps.summary.outcome == 'success' }}
uses: actions/upload-artifact@v7
with:
name: test-summary-${{ github.run_attempt }}-glitching-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/test-summary.json
- name: Collect glitch failure logs
id: glitch_logs
if: ${{ failure() && !cancelled() }}
run: |
if docker exec rtpproxy-tests sh -c \
'test -n "$(find /tmp -maxdepth 1 -type d -name "glitch.*" -print -quit)"'
then
docker exec rtpproxy-tests sh -c \
'cd /tmp && find . -maxdepth 1 -type d -name "glitch.*" -print0 | tar --null -T - -czf -' \
> "${RUNNER_TEMP}/glitch-failures.tar.gz"
echo 'present=true' >> "${GITHUB_OUTPUT}"
fi
- name: Upload glitch failure logs
if: ${{ failure() && !cancelled() && steps.glitch_logs.outputs.present == 'true' }}
uses: actions/upload-artifact@v7
with:
name: glitch-failures-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/glitch-failures.tar.gz
- name: Remove test container
if: ${{ always() }}
run: docker rm --force rtpproxy-tests 2>/dev/null || true
TestSummary:
name: Combined Test Summary
needs: [FuncTest, Glitching]
if: ${{ always() && !cancelled() && (needs.FuncTest.result != 'skipped' || needs.Glitching.result != 'skipped') }}
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- uses: actions/checkout@v7
- name: Download test summaries
uses: actions/download-artifact@v8
with:
pattern: test-summary-*
path: ${{ runner.temp }}/test-results
- name: Publish combined test summary
if: ${{ always() }}
env:
TEST_RESULTS: ${{ toJSON(needs) }}
GH_TOKEN: ${{ github.token }}
run: |
delay=5
for attempt in 1 2 3 4 5; do
if gh api --paginate --slurp \
"repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs?filter=latest&per_page=100" \
> "${RUNNER_TEMP}/test-jobs.json"
then
break
else
status=$?
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::Failed to fetch test jobs after ${attempt} attempts"
exit "$status"
fi
echo "::warning::Failed to fetch test jobs (attempt ${attempt}/5); retrying in ${delay}s"
sleep "$delay"
delay=$((delay * 2))
done
python3 scripts/test-summary.py render --jobs "${RUNNER_TEMP}/test-jobs.json" --results "${RUNNER_TEMP}/test-results" >> "$GITHUB_STEP_SUMMARY"
Fuzzing:
name: Fuzz with OSS-Fuzz
needs: [LoadJobs_conf, Glitching]
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_Fuzzing == 'true' &&
(needs.LoadJobs_conf.outputs.do_Glitch != 'true' || needs.Glitching.result == 'success') }}
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
sanitizer: [address, undefined, memory, coverage]
steps:
- uses: actions/checkout@v7
with:
submodules: 'recursive'
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'rtpproxy'
dry-run: false
language: c
sanitizer: ${{ matrix.sanitizer }}
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
env:
OF_SANITIZER: ${{ matrix.sanitizer }}
with:
oss-fuzz-project-name: 'rtpproxy'
fuzz-seconds: 1200
dry-run: false
parallel-fuzzing: true
language: c
sanitizer: ${{ matrix.sanitizer }}
output-sarif: true
- name: Collect fuzzing coverage
if: matrix.sanitizer == 'coverage'
run: sh -x scripts/fuzz/collect-coverage.sh
- name: Upload fuzzing coverage report
if: matrix.sanitizer == 'coverage'
uses: actions/upload-artifact@v7
with:
name: fuzzing-coverage
path: coverage/lcov.info
overwrite: true
retention-days: 1
- name: Upload Crash
uses: actions/upload-artifact@v7
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts
path: ./out/artifacts
- name: Upload Sarif
if: always() && steps.build.outcome == 'success' && matrix.sanitizer != 'coverage'
uses: github/codeql-action/upload-sarif@v4
with:
# Path to SARIF file relative to the root of the repository
sarif_file: cifuzz-sarif/results.sarif
checkout_path: cifuzz-sarif
# Fetch the Coveralls reporter once per version, so that the coverage jobs
# restore it from the cache instead of all hitting GitHub releases at once.
CoverallsReporter:
name: Cache Coveralls Reporter
needs: LoadJobs_conf
if: ${{ needs.LoadJobs_conf.outputs.do_FuncTest == 'true' ||
needs.LoadJobs_conf.outputs.do_Glitch == 'true' ||
needs.LoadJobs_conf.outputs.do_Fuzzing == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Look up Coveralls reporter
id: cache
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
lookup-only: true
- uses: actions/checkout@v7
if: steps.cache.outputs.cache-hit != 'true'
- name: Download Coveralls reporter
if: steps.cache.outputs.cache-hit != 'true'
run: sh -x scripts/install-coveralls.sh "${COVERALLS_REPORTER_VERSION}" "${RUNNER_TEMP}/coveralls"
- name: Save Coveralls reporter
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
Coverage:
name: Upload Coverage
needs: [LoadJobs_conf, CoverallsReporter, FuncTest, Glitching]
if: ${{ !cancelled() && (needs.FuncTest.result != 'skipped' ||
needs.Glitching.result != 'skipped') }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_FullBuild) }}
steps:
- uses: actions/checkout@v7
- name: Download coverage reports
uses: actions/download-artifact@v8
with:
pattern: coverage-*-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/coverage
# Add up all test suites run with this build, so that its branches are
# counted together in one upload.
- name: Merge coverage reports
id: merge
run: |
set -- "${RUNNER_TEMP}"/coverage/*/lcov.info
if [ ! -e "${1}" ]
then
echo "No coverage reports for this build"
exit 0
fi
mkdir -p coverage
python3 scripts/merge-coverage-branches.py --drop-declarations \
-o coverage/lcov.info "${@}"
# Branches of different compilers do not match up: they only get to
# Coveralls through the fuzzing report, blended into its own ones.
python3 scripts/merge-coverage-branches.py --no-branches \
-o coverage/coveralls.info coverage/lcov.info
echo 'present=true' >> "${GITHUB_OUTPUT}"
- name: Upload merged coverage report
if: steps.merge.outputs.present == 'true'
uses: actions/upload-artifact@v7
with:
name: merged-coverage-${{ matrix.os }}-${{ matrix.compiler }}
path: coverage/lcov.info
overwrite: true
retention-days: 1
- name: Restore Coveralls reporter
if: steps.merge.outputs.present == 'true'
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
fail-on-cache-miss: true
- name: Upload coverage to Coveralls
if: steps.merge.outputs.present == 'true'
env:
TZ: UTC
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: tests-${{ matrix.os }}-${{ matrix.compiler }}
COVERALLS_PARALLEL: true
COVERALLS_SOURCE_HEADER: github-action
run: '"${RUNNER_TEMP}/coveralls/coveralls" report --format lcov coverage/coveralls.info'
FuzzCoverage:
name: Upload Fuzzing Coverage
needs: [CoverallsReporter, Coverage, Fuzzing]
if: ${{ !cancelled() && needs.Fuzzing.result != 'skipped' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- name: Download coverage reports
uses: actions/download-artifact@v8
with:
pattern: '{fuzzing,merged}-coverage*'
path: ${{ runner.temp }}/coverage
# Source-based fuzzing coverage does not match the tests' gcov records.
# Keep its own records and count what the tests covered in them.
- name: Blend test coverage into fuzzing coverage
id: merge
run: |
FUZZ="${RUNNER_TEMP}/coverage/fuzzing-coverage/lcov.info"
if [ ! -e "${FUZZ}" ]
then
echo "No fuzzing coverage report"
exit 0
fi
sed -i "s|^SF:\([^/]\)|SF:${GITHUB_WORKSPACE}/\1|" "${FUZZ}"
set --
for report in "${RUNNER_TEMP}"/coverage/merged-coverage-*/lcov.info
do
if [ -e "${report}" ]
then
set -- "${@}" --blend "${report}"
fi
done
mkdir -p coverage
python3 scripts/merge-coverage-branches.py --drop-declarations \
-o coverage/lcov.info "${@}" "${FUZZ}"
echo 'present=true' >> "${GITHUB_OUTPUT}"
- name: Restore Coveralls reporter
if: steps.merge.outputs.present == 'true'
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
fail-on-cache-miss: true
- name: Upload fuzzing coverage to Coveralls
if: steps.merge.outputs.present == 'true'
env:
TZ: UTC
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: fuzzing-coverage
COVERALLS_PARALLEL: true
COVERALLS_SOURCE_HEADER: github-action
run: '"${RUNNER_TEMP}/coveralls/coveralls" report --format lcov coverage/lcov.info'
FinishCoverage:
name: Finish Coveralls Build
needs: [CoverallsReporter, Coverage, FuzzCoverage]
if: ${{ always() && (needs.Coverage.result != 'skipped' ||
needs.FuzzCoverage.result != 'skipped') }}
runs-on: ubuntu-latest
steps:
- name: Restore Coveralls reporter
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
fail-on-cache-miss: true
- name: Complete parallel coverage build
env:
TZ: UTC
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SOURCE_HEADER: github-action
run: '"${RUNNER_TEMP}/coveralls/coveralls" done'
Docker:
name: Build&Push to DockerHub
needs: [LoadJobs_conf, Fuzzing]
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_Docker == 'true' &&
(needs.LoadJobs_conf.outputs.do_Fuzzing != 'true' || needs.Fuzzing.result == 'success') &&
(github.event_name == 'push' || github.event_name == 'pull_request') }}
runs-on: ubuntu-latest
permissions:
packages: write
services:
registry:
image: registry:2
ports:
- 5000:5000
env:
CLANG_VER_NEW: 19
CLANG_VER_OLD: 19
DOCKER_REPO: sippylabs/rtpproxy
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/rtpproxy
LOCAL_REPO: localhost:5000/sippylabs/rtpproxy
BASE_IMAGE: ${{ matrix.base_image }}
CCACHE_ROOT: ccache
DOCKER_RW: ${{ ( github.repository == 'sippy/rtpproxy' && github.event_name != 'pull_request' ) && 'true' || 'false' }}
CCACHE_BIN_IMAGE: ghcr.io/sobomax/ccache:${{ matrix.ccache_bin_image }}
strategy:
fail-fast: false
matrix:
include:
- base_image: 'debian:12-slim'
ccache_bin_image: 'latest-debian-12'
- base_image: 'debian:13-slim'
ccache_bin_image: 'latest-debian-13'
- base_image: 'ubuntu:24.04'
ccache_bin_image: 'latest-ubuntu-24.04'
- base_image: 'ubuntu:latest'
ccache_bin_image: 'latest-ubuntu-26.04'
steps:
- name: Maximize build space
shell: sh -x -e {0}
run: |
echo "Memory and swap:"
sudo free -h
echo
sudo swapon --show
echo
echo "Available storage:"
sudo df -h
echo
PIDS=""
for d in /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
do
sudo rm -rf "${d}" &
PIDS="${PIDS} ${!}"
done
sudo docker image prune --all --force &
PIDS="${PIDS} ${!}"
for pid in ${PIDS}
do
wait ${pid}
done
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: 'recursive'
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
driver-opts: network=host
- name: Log in to Docker Hub
if: env.DOCKER_RW == 'true'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set dynamic environment
run: |
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
GIT_BRANCH="${GIT_BRANCH#refs/tags/}"
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV
OS_TAG="`echo ${BASE_IMAGE} | sed 's|:|_|g'`"
BRANCH_TAG="`echo ${GIT_BRANCH} | sed 's|/|_|g'`"
if [ "${DOCKER_RW}" = "true" ]
then
CCACHE_IMAGE="${{ env.GHCR_REPO }}:${BRANCH_TAG}-${OS_TAG}-cccache"
else
CCACHE_IMAGE="${{ env.GHCR_REPO }}:master-${OS_TAG}-cccache"
fi
CACHE_SPEC="type=registry,ref=${CCACHE_IMAGE}"
echo "CACHE_SPEC=${CACHE_SPEC}" >> $GITHUB_ENV
if ! docker pull ${CCACHE_IMAGE} 2>&1 >/dev/null
then
CCACHE_BIMAGE="scratch"
else
CCACHE_BIMAGE="${CCACHE_IMAGE}"
fi
docker pull ${CCACHE_BIN_IMAGE}
echo "BRANCH_TAG=${BRANCH_TAG}" >> $GITHUB_ENV
echo "CCACHE_IMAGE=${CCACHE_IMAGE}" >> $GITHUB_ENV
echo "CCACHE_BIMAGE=${CCACHE_BIMAGE}" >> $GITHUB_ENV
echo "BUILD_IMAGE=${{ env.LOCAL_REPO }}:latest-${OS_TAG}" >> $GITHUB_ENV
echo "LIBG722_IMAGE=sippylabs/libg722:latest-${OS_TAG}" >> $GITHUB_ENV
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
grep -v unknown | sort -u | paste -sd ','`"
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
echo "OS_TAG=${OS_TAG}" >> $GITHUB_ENV
if [[ "${{ matrix.base_image }}" == debian:12* ]]
then
echo "LIBSSL_APKG=libssl3" >> $GITHUB_ENV
else
echo "LIBSSL_APKG=libssl3t64" >> $GITHUB_ENV
fi
if [ "${{ matrix.base_image }}" = "ubuntu:latest" -a "${{ github.ref_name }}" = "${{ github.event.repository.default_branch }}" ]
then
echo "ADD_LATEST=true" >> "$GITHUB_ENV"
else
echo "ADD_LATEST=false" >> "$GITHUB_ENV"
fi
- name: Extract metadata (tags, labels) for Docker
id: meta_dkr
uses: docker/metadata-action@v6
with:
images: ${{ env.DOCKER_REPO }}
tags: |
type=schedule,suffix=-${{ env.OS_TAG }}
type=ref,event=branch,suffix=-${{ env.OS_TAG }}
type=ref,event=tag,suffix=-${{ env.OS_TAG }}
type=ref,event=pr,suffix=-${{ env.OS_TAG }}
type=raw,value=latest-${{ env.OS_TAG }},enable={{is_default_branch}}
type=sha,suffix=-${{ env.OS_TAG }}
type=raw,value=latest,enable=${{ env.ADD_LATEST == 'true' }}
- name: Extract metadata (tags, labels) for GHCR
id: meta_ghcr
uses: docker/metadata-action@v6
with:
images: ${{ env.GHCR_REPO }}
tags: |
type=schedule,suffix=-${{ env.OS_TAG }}
type=ref,event=branch,suffix=-${{ env.OS_TAG }}
type=ref,event=tag,suffix=-${{ env.OS_TAG }}
type=ref,event=pr,suffix=-${{ env.OS_TAG }}
type=raw,value=latest-${{ env.OS_TAG }},enable={{is_default_branch}}
type=sha,suffix=-${{ env.OS_TAG }}
type=raw,value=latest,enable=${{ env.ADD_LATEST == 'true' }}
- name: Build Docker image
if: env.DOCKER_RW == 'true'
uses: docker/build-push-action@v7
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: ./docker/Dockerfile
build-args: |
CLANG_VER_OLD=${{ env.CLANG_VER_OLD }}
CLANG_VER_NEW=${{ env.CLANG_VER_NEW }}
BASE_IMAGE=${{ env.BASE_IMAGE }}
LIBG722_IMAGE=${{ env.LIBG722_IMAGE }}
CCACHE_IMAGE=${{ env.CCACHE_BIMAGE }}
CCACHE_BIN_IMAGE=${{ env.CCACHE_BIN_IMAGE }}
CCACHE_ROOT=${{ env.CCACHE_ROOT }}
LIBSSL_APKG=${{ env.LIBSSL_APKG }}
tags: ${{ env.BUILD_IMAGE }}
platforms: ${{ env.PLATFORMS }}
push: true
cache-from: ${{ env.CACHE_SPEC }}
cache-to: ${{ env.CACHE_SPEC }},mode=max
- name: Build Docker image (PR)
if: env.DOCKER_RW != 'true'
uses: docker/build-push-action@v7
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: ./docker/Dockerfile
build-args: |
CLANG_VER_OLD=${{ env.CLANG_VER_OLD }}
CLANG_VER_NEW=${{ env.CLANG_VER_NEW }}
BASE_IMAGE=${{ env.BASE_IMAGE }}
LIBG722_IMAGE=${{ env.LIBG722_IMAGE }}
CCACHE_IMAGE=${{ env.CCACHE_BIMAGE }}
CCACHE_BIN_IMAGE=${{ env.CCACHE_BIN_IMAGE }}
CCACHE_ROOT=${{ env.CCACHE_ROOT }}
LIBSSL_APKG=${{ env.LIBSSL_APKG }}
tags: ${{ env.BUILD_IMAGE }}
platforms: ${{ env.PLATFORMS }}
push: true
cache-from: ${{ env.CACHE_SPEC }}
- name: Export ccache
if: env.DOCKER_RW == 'true'
uses: docker/build-push-action@v7
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
file: ./docker/Dockerfile.export_ccache
build-args: BUILD_IMAGE=${{ env.BUILD_IMAGE }}
tags: ${{ env.CCACHE_IMAGE }}
platforms: ${{ env.PLATFORMS }}
push: true
- name: Push Docker image
if: env.DOCKER_RW == 'true'
uses: docker/build-push-action@v7
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: ./docker/Dockerfile.push
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
BUILD_IMAGE=${{ env.BUILD_IMAGE }}
push: true
tags: |
${{ steps.meta_dkr.outputs.tags }}
${{ steps.meta_ghcr.outputs.tags }}
labels: |
${{ steps.meta_dkr.outputs.labels }}
${{ steps.meta_ghcr.outputs.labels }}
platforms: ${{ env.PLATFORMS }}
- name: Update DockerHub repo description
if: env.DOCKER_RW == 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: sh -x docker/update_description.sh docker/README.md
roll_release:
name: Roll Release
needs: [LoadJobs_conf, Docker, BuildPackages]
permissions:
contents: write
uses: sippy/cimagic/.github/workflows/RollReleaseDraft.yml@v3
with:
release_files_artifacts: |
${{ needs.BuildPackages.outputs.dpkgs_artifacts }}