-
Notifications
You must be signed in to change notification settings - Fork 1.4k
103 lines (96 loc) · 2.95 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
name: CI
on:
push:
branches:
- master
- v1.10
pull_request:
types:
- opened
- synchronize
workflow_dispatch:
inputs:
freeswitch_ref:
description: 'FreeSWITCH repository ref'
required: false
type: string
sofia-sip_ref:
description: 'Sofia-Sip repository ref'
required: false
type: string
dind:
description: 'Run tests using Docker-in-Docker'
required: false
type: boolean
default: false
env:
CI_BASE_STATIC_IMAGE: signalwire/freeswitch-public-ci-base:bookworm-amd64
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_CHECKS_ANNOTATIONS: false
DOCKER_BUILD_RECORD_UPLOAD: false
jobs:
unit-tests-pre-config:
if: ${{ !inputs.dind }}
name: "Unit-tests pre-config"
runs-on: ubuntu-latest
env:
TOTAL_GROUPS: 2
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
container-image: ${{ steps.set-vars.outputs.container-image }}
working-directory: ${{ steps.set-vars.outputs.working-directory }}
tests-only: ${{ steps.set-vars.outputs.tests-only }}
steps:
- id: set-matrix
shell: bash
run: |
MATRIX=$(jq -c -n --argjson groups "${{ env.TOTAL_GROUPS }}" \
'{
include: [range(1; $groups + 1) | {group: ., total: $groups}]
}')
echo "matrix=$MATRIX" | tee -a $GITHUB_OUTPUT
- id: set-vars
shell: bash
run: |
echo "tests-only=false" >> $GITHUB_OUTPUT
echo "working-directory=freeswitch/tests/unit" >> $GITHUB_OUTPUT
echo "container-image=$CI_BASE_STATIC_IMAGE" >> $GITHUB_OUTPUT
unit-tests:
if: ${{ !inputs.dind }}
name: "Unit-tests (group ${{ matrix.group }})"
needs:
- unit-tests-pre-config
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.unit-tests-pre-config.outputs.matrix) }}
uses: ./.github/workflows/unit-test.yml
with:
total-groups: ${{ matrix.total }}
current-group: ${{ matrix.group }}
container-image: ${{ needs.unit-tests-pre-config.outputs.container-image }}
working-directory: ${{ needs.unit-tests-pre-config.outputs.working-directory }}
tests-only: ${{ fromJson(needs.unit-tests-pre-config.outputs.tests-only) }}
secrets: inherit
validate-unit-tests:
if: ${{ always() && !inputs.dind }}
name: "Validate Unit-tests"
needs: unit-tests
runs-on: ubuntu-latest
steps:
- name: Check unit tests status
run: |
if [ "${{ needs.unit-tests.result }}" != "success" ]; then
exit 1
fi
unit-tests-dind:
if: ${{ inputs.dind }}
name: "Unit-tests D-in-D"
uses: ./.github/workflows/unit-test-dind.yml
with:
freeswitch_ref: ${{ inputs.freeswitch_ref }}
sofia-sip_ref: ${{ inputs.sofia-sip_ref }}
secrets: inherit
scan-build:
name: "Scan Build"
uses: ./.github/workflows/scan-build.yml
secrets: inherit