Skip to content

Commit

Permalink
Merge branch 'signalwire:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
markjcrane authored Dec 12, 2024
2 parents 25b2b7b + ce1826e commit ff4660d
Show file tree
Hide file tree
Showing 30 changed files with 1,327 additions and 226 deletions.
24 changes: 24 additions & 0 deletions .github/docker/debian/bookworm/amd64/CI/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG BUILDER_IMAGE=signalwire/freeswitch-public-ci-base:bookworm-amd64

FROM ${BUILDER_IMAGE}

ARG MAINTAINER_EMAIL="[email protected]"

LABEL org.opencontainers.image.authors="${MAINTAINER_EMAIL}"

SHELL ["/bin/bash", "-c"]

COPY --from=sofia-sip / /usr/src/sofia-sip
COPY --from=freeswitch / /usr/src/freeswitch

RUN cd /usr/src/freeswitch && \
./ci.sh -t unit-test -a configure -c sofia-sip -p "/usr/src/sofia-sip" && \
./ci.sh -t unit-test -a build -c sofia-sip -p "/usr/src/sofia-sip" && \
./ci.sh -t unit-test -a install -c sofia-sip -p "/usr/src/sofia-sip" && \
./ci.sh -t unit-test -a configure -c freeswitch -p "/usr/src/freeswitch" && \
./ci.sh -t unit-test -a build -c freeswitch -p "/usr/src/freeswitch" && \
./ci.sh -t unit-test -a install -c freeswitch -p "/usr/src/freeswitch"

WORKDIR /usr/src/freeswitch/tests/unit

ENTRYPOINT ["/usr/src/freeswitch/tests/unit/run-tests.sh"]
93 changes: 90 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,32 @@ on:
paths:
- "**"
workflow_dispatch:
inputs:
freeswitch_ref:
description: 'FreeSWITCH repository ref'
required: true
default: master
type: string
release:
description: 'FreeSWITCH release type'
type: choice
required: true
default: unstable
options:
- release
- unstable
publish:
description: 'Publish build data'
required: true
default: false
type: boolean

concurrency:
group: ${{ github.head_ref || github.ref }}

jobs:
preconfig:
name: 'Preconfig'
runs-on: ubuntu-latest
outputs:
deb: ${{ steps.deb.outputs.excludes }}
Expand Down Expand Up @@ -59,6 +79,8 @@ jobs:
elif [[ '${{ github.base_ref }}' == 'v1.10' ]]; then
echo 'release=release' | tee -a $GITHUB_OUTPUT
fi
elif [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then
echo 'release=${{ inputs.release }}' | tee -a $GITHUB_OUTPUT
elif [[ '${{ github.ref }}' == 'refs/heads/master' ]]; then
echo 'release=unstable' | tee -a $GITHUB_OUTPUT
elif [[ '${{ github.ref }}' == 'refs/heads/v1.10' ]]; then
Expand All @@ -67,13 +89,41 @@ jobs:
exit 1
fi
get-nonce:
name: 'Get Nonce for token'
runs-on: freeswitch-repo-auth-client
outputs:
nonce: ${{ steps.get-nonce.outputs.nonce }}
steps:
- name: Get Nonce
id: get-nonce
uses: signalwire/actions-template/.github/actions/repo-auth-client@main
with:
mode: nonce

issue-token:
name: 'Issue temporary token'
runs-on: ubuntu-latest
needs: get-nonce
outputs:
token: ${{ steps.issue-token.outputs.token }}
steps:
- name: Issue Token
id: issue-token
uses: signalwire/actions-template/.github/actions/repo-auth-client@main
env:
NONCE: ${{ needs.get-nonce.outputs.nonce }}
with:
mode: issue

deb-public:
name: 'DEB-PUBLIC'
permissions:
id-token: write
contents: read
needs:
- preconfig
- issue-token
uses: signalwire/actions-template/.github/workflows/cicd-docker-build-and-distribute.yml@main
strategy:
# max-parallel: 1
Expand All @@ -96,26 +146,63 @@ jobs:
exclude: ${{ fromJson(needs.preconfig.outputs.deb) }}
with:
RUNNER: ${{ matrix.platform.runner }}
REF: ${{ inputs.freeswitch_ref }}
ARTIFACTS_PATTERN: '.*\.(deb|dsc|changes|tar.bz2|tar.gz|tar.lzma|tar.xz)$'
DOCKERFILE: .github/docker/${{ matrix.os }}/${{ matrix.version }}/${{ matrix.platform.name }}/public.${{ matrix.release }}.Dockerfile
MAINTAINER: 'Andrey Volk <[email protected]>'
META_FILE_PATH_PREFIX: /var/www/freeswitch/public/${{ matrix.release }}/${{ github.ref_name }}/${{ github.run_id }}-${{ github.run_number }}
PLATFORM: ${{ matrix.platform.name }}
REPO_DOMAIN: 'freeswitch.signalwire.com'
TARGET_ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.version }}-${{ matrix.platform.name }}-public-${{ matrix.release }}-artifact
UPLOAD_BUILD_ARTIFACTS: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, ':upload-artifacts') }}
UPLOAD_BUILD_ARTIFACTS: >-
${{
(github.event.pull_request.head.repo.full_name == github.repository) &&
(
(
github.event_name != 'pull_request' &&
github.event_name != 'workflow_dispatch'
) ||
(github.event_name == 'workflow_dispatch' && inputs.publish)
)
}}
secrets:
GH_BOT_DEPLOY_TOKEN: ${{ secrets.PAT }}
HOSTNAME: ${{ secrets.HOSTNAME }}
PROXY_URL: ${{ secrets.PROXY_URL }}
USERNAME: ${{ secrets.USERNAME }}
TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }}
REPO_USERNAME: 'SWUSERNAME'
REPO_PASSWORD: ${{ secrets.REPOTOKEN }}
REPO_PASSWORD: ${{ needs.issue-token.outputs.token }}

revoke-token:
name: 'Revoke temporary token'
runs-on: ubuntu-latest
# if: always()
needs:
- issue-token
- deb-public
steps:
- name: Revoke Token
id: revoke-token
uses: signalwire/actions-template/.github/actions/repo-auth-client@main
env:
TOKEN: ${{ needs.issue-token.outputs.token }}
with:
mode: revoke

meta:
name: 'Publish build data to meta-repo'
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.title, ':upload-artifacts') }}
if: >-
${{
(github.event.pull_request.head.repo.full_name == github.repository) &&
(
(
github.event_name != 'pull_request' &&
github.event_name != 'workflow_dispatch'
) ||
(github.event_name == 'workflow_dispatch' && inputs.publish)
)
}}
needs:
- deb-public
permissions:
Expand Down
124 changes: 61 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,45 @@ 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
Expand All @@ -25,81 +52,52 @@ jobs:
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:
needs: unit-tests-pre-config
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) }}
name: "unit-tests (group ${{ matrix.group }})"
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

scan-build:
validate-unit-tests:
if: ${{ always() && !inputs.dind }}
name: "Validate Unit-tests"
needs: unit-tests
runs-on: ubuntu-latest
container:
image: signalwire/freeswitch-public-base:bookworm
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
options: --privileged
env:
REPOTOKEN: ${{ secrets.REPOTOKEN }}
DEBIAN_FRONTEND: noninteractive

steps:
- name: Install dependencies
shell: bash
- name: Check unit tests status
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 \
autoconf \
libsofia-sip-ua-dev \
libspandsp3-dev && \
rm -rf /etc/apt/auth.conf
- name: Checkout code
uses: actions/checkout@v4
with:
path: /__w/freeswitch/freeswitch
if [ "${{ needs.unit-tests.result }}" != "success" ]; then
exit 1
fi
- name: Bootstrap
shell: bash
working-directory: /__w/freeswitch/freeswitch
run: |
./bootstrap.sh -j || exit 1
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

- name: Scan-build FreeSwitch
shell: bash
working-directory: /__w/freeswitch/freeswitch
run: |
cp build/modules.conf.most modules.conf && \
echo 'codecs/mod_openh264' >> modules.conf && \
sed -i \
-e '/mod_mariadb/s/^#//g' \
-e '/mod_v8/s/^#//g' \
-e '/mod_ilbc/s/^/#/g' \
-e '/mod_isac/s/^/#/g' \
-e '/mod_mp4/s/^/#/g' \
-e '/mod_mongo/s/^/#/g' \
-e '/mod_pocketsphinx/s/^/#/g' \
-e '/mod_sangoma_codec/s/^/#/g' \
-e '/mod_siren/s/^/#/g' \
-e '/mod_avmd/s/^/#/g' \
-e '/mod_basic/s/^/#/g' \
-e '/mod_cdr_mongodb/s/^/#/g' \
-e '/mod_cv/s/^/#/g' \
-e '/mod_erlang_event/s/^/#/g' \
-e '/mod_perl/s/^/#/g' \
-e '/mod_rtmp/s/^/#/g' \
-e '/mod_unimrcp/s/^/#/g' \
-e '/mod_xml_rpc/s/^/#/g' \
modules.conf && \
./configure && \
./scan_build.sh
scan-build:
name: "Scan Build"
uses: ./.github/workflows/scan-build.yml
secrets: inherit
Loading

0 comments on commit ff4660d

Please sign in to comment.