2024-07-25 17:47:30 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2024-12-02 01:16:21 +00:00
|
|
|
- v1.10
|
2024-07-25 17:47:30 +00:00
|
|
|
pull_request:
|
|
|
|
types:
|
|
|
|
- opened
|
|
|
|
- synchronize
|
2024-12-02 01:16:21 +00:00
|
|
|
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
|
2024-07-25 17:47:30 +00:00
|
|
|
|
|
|
|
jobs:
|
2024-10-12 17:02:23 +00:00
|
|
|
unit-tests-pre-config:
|
2024-12-02 01:16:21 +00:00
|
|
|
if: ${{ !inputs.dind }}
|
|
|
|
name: "Unit-tests pre-config"
|
2024-10-12 17:02:23 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
TOTAL_GROUPS: 2
|
|
|
|
outputs:
|
|
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
2024-12-02 01:16:21 +00:00
|
|
|
container-image: ${{ steps.set-vars.outputs.container-image }}
|
|
|
|
working-directory: ${{ steps.set-vars.outputs.working-directory }}
|
|
|
|
tests-only: ${{ steps.set-vars.outputs.tests-only }}
|
2024-10-12 17:02:23 +00:00
|
|
|
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
|
2024-12-02 01:16:21 +00:00
|
|
|
- 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
|
2024-07-25 17:47:30 +00:00
|
|
|
|
2024-10-12 17:02:23 +00:00
|
|
|
unit-tests:
|
2024-12-02 01:16:21 +00:00
|
|
|
if: ${{ !inputs.dind }}
|
|
|
|
name: "Unit-tests (group ${{ matrix.group }})"
|
|
|
|
needs:
|
|
|
|
- unit-tests-pre-config
|
2024-10-12 17:02:23 +00:00
|
|
|
strategy:
|
2024-12-02 01:16:21 +00:00
|
|
|
fail-fast: false
|
2024-10-12 17:02:23 +00:00
|
|
|
matrix: ${{ fromJson(needs.unit-tests-pre-config.outputs.matrix) }}
|
2024-07-25 17:47:30 +00:00
|
|
|
uses: ./.github/workflows/unit-test.yml
|
|
|
|
with:
|
2024-10-12 17:02:23 +00:00
|
|
|
total-groups: ${{ matrix.total }}
|
|
|
|
current-group: ${{ matrix.group }}
|
2024-12-02 01:16:21 +00:00
|
|
|
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) }}
|
2024-07-25 17:47:30 +00:00
|
|
|
secrets: inherit
|
|
|
|
|
2024-12-02 01:16:21 +00:00
|
|
|
validate-unit-tests:
|
|
|
|
if: ${{ always() && !inputs.dind }}
|
|
|
|
name: "Validate Unit-tests"
|
|
|
|
needs: unit-tests
|
2024-07-25 17:47:30 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-12-02 01:16:21 +00:00
|
|
|
- name: Check unit tests status
|
2024-07-25 17:47:30 +00:00
|
|
|
run: |
|
2024-12-02 01:16:21 +00:00
|
|
|
if [ "${{ needs.unit-tests.result }}" != "success" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-07-25 17:47:30 +00:00
|
|
|
|
2024-12-02 01:16:21 +00:00
|
|
|
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
|
2024-07-25 17:47:30 +00:00
|
|
|
|
2024-12-02 01:16:21 +00:00
|
|
|
scan-build:
|
|
|
|
name: "Scan Build"
|
|
|
|
uses: ./.github/workflows/scan-build.yml
|
|
|
|
secrets: inherit
|