mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
[GHA] Refactor workflows
This commit is contained in:
+102
-76
@@ -7,19 +7,41 @@ on:
|
||||
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: signalwire/freeswitch-public-base:bookworm
|
||||
credentials:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
image: ${{ inputs.container-image }}
|
||||
options: --privileged
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
@@ -29,83 +51,87 @@ jobs:
|
||||
- name: Override core_pattern
|
||||
shell: bash
|
||||
run: |
|
||||
cat /proc/sys/kernel/core_pattern
|
||||
echo '/cores/core.%s.%E.%e.%p.%t' > /proc/sys/kernel/core_pattern
|
||||
cat /proc/sys/kernel/core_pattern
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
env:
|
||||
REPOTOKEN: ${{ secrets.REPOTOKEN }}
|
||||
run: |
|
||||
echo "machine freeswitch.signalwire.com password $REPOTOKEN" > /etc/apt/auth.conf && \
|
||||
apt-get update && \
|
||||
apt-get -y remove \
|
||||
libsofia-sip-ua0 \
|
||||
libspandsp-dev && \
|
||||
apt-get -y install \
|
||||
libspandsp3-dev && \
|
||||
rm -rf /etc/apt/auth.conf
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: /__w/freeswitch/freeswitch
|
||||
|
||||
- name: Bootstrap
|
||||
shell: bash
|
||||
working-directory: /__w/freeswitch/freeswitch
|
||||
run: |
|
||||
./bootstrap.sh -j || exit 1
|
||||
|
||||
- name: Checkout Sofia-Sip
|
||||
- name: Checkout Sofia-Sip (via ref)
|
||||
if: ${{ !inputs.tests-only && inputs.sofia-sip_ref != '' }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: freeswitch/sofia-sip
|
||||
path: /__w/freeswitch/freeswitch/sofia-sip
|
||||
ref: ${{ inputs.sofia-sip_ref }}
|
||||
path: sofia-sip
|
||||
|
||||
- name: Build sofia-sip
|
||||
shell: bash
|
||||
working-directory: /__w/freeswitch/freeswitch/sofia-sip
|
||||
run: |
|
||||
./autogen.sh && \
|
||||
./configure.gnu && \
|
||||
make -j$(nproc --all) install
|
||||
|
||||
- name: Build FreeSwitch
|
||||
shell: bash
|
||||
working-directory: /__w/freeswitch/freeswitch
|
||||
run: |
|
||||
echo 'codecs/mod_openh264' >> modules.conf && \
|
||||
sed -i \
|
||||
-e '/applications\/mod_http_cache/s/^#//g' \
|
||||
-e '/event_handlers\/mod_rayo/s/^#//g' \
|
||||
-e '/formats\/mod_opusfile/s/^#//g' \
|
||||
-e '/languages\/mod_lua/s/^#//g' \
|
||||
modules.conf && \
|
||||
./configure \
|
||||
--enable-address-sanitizer \
|
||||
--enable-fake-dlclose && \
|
||||
make -j$(nproc --all) |& tee ./unit-tests-build-result.txt
|
||||
|
||||
echo ${PIPESTATUS[0]} > ./build-status.txt
|
||||
if ! test "$(cat ./build-status.txt | tr -d '[:space:]')" -eq 0; then
|
||||
exit "$(cat ./build-status.txt | tr -d '[:space:]')"
|
||||
fi
|
||||
make install
|
||||
|
||||
- name: Run tests
|
||||
shell: bash
|
||||
working-directory: /__w/freeswitch/freeswitch/tests/unit
|
||||
run: |
|
||||
./run-tests.sh ${{ inputs.total-groups }} ${{ inputs.current-group }}
|
||||
mkdir logs && (mv log_run-tests_*.html logs || true) && (mv backtrace_*.txt logs || true)
|
||||
./collect-test-logs.sh
|
||||
|
||||
- name: Notify result
|
||||
if: failure()
|
||||
uses: signalwire/actions-template/.github/actions/notify-ci-result@main
|
||||
- name: Checkout Sofia-Sip
|
||||
if: ${{ !inputs.tests-only && inputs.sofia-sip_ref == '' }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
for: "run_tests"
|
||||
test_logs_path: /__w/freeswitch/freeswitch/tests/unit
|
||||
test_artifacts_suffix: "-${{ inputs.current-group }}"
|
||||
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
|
||||
retention-days: 3
|
||||
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 }}
|
||||
|
||||
Reference in New Issue
Block a user