forked from signalwire/freeswitch
-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (123 loc) · 4.66 KB
/
unit-test.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
name: Unit tests
on:
workflow_call:
inputs:
total-groups:
description: 'Total number of test groups'
required: true
type: number
default: 1
current-group:
description: 'Current test group number'
required: true
type: number
default: 1
freeswitch_ref:
description: 'FreeSWITCH repository ref'
required: false
type: string
sofia-sip_ref:
description: 'Sofia-Sip repository ref'
required: false
type: string
container-image:
description: 'Container image to use for running tests'
required: false
type: string
default: 'signalwire/freeswitch-public-ci-base:bookworm-amd64'
working-directory:
description: 'Working directory for running tests'
required: false
type: string
default: 'freeswitch/tests/unit'
tests-only:
description: 'Run only tests, skip other tasks'
required: false
type: boolean
default: false
jobs:
unit-test:
runs-on: ubuntu-latest
container:
image: ${{ inputs.container-image }}
options: --privileged
env:
DEBIAN_FRONTEND: noninteractive
ASAN_OPTIONS: log_path=stdout:disable_coredump=0:unmap_shadow_on_exit=1:fast_unwind_on_malloc=0
steps:
- name: Override core_pattern
shell: bash
run: |
echo '/cores/core.%s.%E.%e.%p.%t' > /proc/sys/kernel/core_pattern
cat /proc/sys/kernel/core_pattern
- name: Checkout Sofia-Sip (via ref)
if: ${{ !inputs.tests-only && inputs.sofia-sip_ref != '' }}
uses: actions/checkout@v4
with:
repository: freeswitch/sofia-sip
ref: ${{ inputs.sofia-sip_ref }}
path: sofia-sip
- name: Checkout Sofia-Sip
if: ${{ !inputs.tests-only && inputs.sofia-sip_ref == '' }}
uses: actions/checkout@v4
with:
repository: freeswitch/sofia-sip
path: sofia-sip
- name: Checkout FreeSWITCH (via ref)
if: ${{ !inputs.tests-only && inputs.freeswitch_ref != '' }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.freeswitch_ref }}
path: freeswitch
- name: Checkout FreeSWITCH
if: ${{ !inputs.tests-only && inputs.freeswitch_ref == '' }}
uses: actions/checkout@v4
with:
path: freeswitch
- name: Configure, Build and Install Sofia-Sip
if: ${{ !inputs.tests-only }}
shell: bash
working-directory: freeswitch
run: |
./ci.sh -t unit-test -a configure -c sofia-sip -p "$GITHUB_WORKSPACE/sofia-sip"
./ci.sh -t unit-test -a build -c sofia-sip -p "$GITHUB_WORKSPACE/sofia-sip"
./ci.sh -t unit-test -a install -c sofia-sip -p "$GITHUB_WORKSPACE/sofia-sip"
- name: Configure, Build and Install FreeSWITCH
if: ${{ !inputs.tests-only }}
shell: bash
working-directory: freeswitch
run: |
./ci.sh -t unit-test -a configure -c freeswitch -p "$GITHUB_WORKSPACE/freeswitch"
./ci.sh -t unit-test -a build -c freeswitch -p "$GITHUB_WORKSPACE/freeswitch"
./ci.sh -t unit-test -a install -c freeswitch -p "$GITHUB_WORKSPACE/freeswitch"
- name: Run unit tests
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
./run-tests.sh ${{ inputs.total-groups }} ${{ inputs.current-group }} --output-dir logs || exit 1
- name: Collect unit test logs
if: always()
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
test -d "/cores" && ls -lah /cores
./collect-test-logs.sh --dir logs --print
- name: Upload Unit-Test logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ github.sha }}-${{ github.run_number }}-${{ inputs.current-group }}-of-${{ inputs.total-groups }}
path: ${{ inputs.working-directory }}/logs
if-no-files-found: ignore
compression-level: 9
- name: Notify run tests result to slack
if: |
failure() &&
github.event_name == 'push' &&
(github.ref == 'refs/heads/master' || github.ref == 'refs/heads/v1.10')
uses: signalwire/actions-template/.github/actions/slack@main
with:
CHANNEL: ${{ secrets.SLACK_DEVOPS_CI_CHANNEL }}
MESSAGE: Unit-Tests ${{ github.repository }} > <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }}>. Some tests are failing.
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}