Add build_test_rtp_io_dock. #139
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: rtp.io | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on all push or pull request events | |
push: | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
COMPILER: clang-18 | |
COMPILER_OLS: clang-16 | |
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/opensips | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build_test_rtp_io: | |
name: Build & Test rtp.io module | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
container: | |
image: sippylabs/rtpproxy:latest | |
options: --cap-add=SYS_PTRACE --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 | |
env: | |
PYTHON_VERSION: 3.12 | |
BUILD_OS: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Install git | |
run: | | |
apt-get update | |
apt-get install -y git lsb-release gnupg2 wget | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Checkout VoIPTests repo | |
uses: actions/checkout@v4 | |
with: | |
repository: 'sippy/voiptests' | |
path: dist/voiptests | |
- name: Checkout RTPProxy repo | |
uses: actions/checkout@v4 | |
with: | |
repository: 'sippy/rtpproxy' | |
path: dist/rtpproxy | |
- name: Install dependencies | |
run: | | |
sh -x scripts/build/reset_sources.sh | |
sh -x scripts/build/install_depends.sh | |
- name: Build | |
run: | | |
KEEP_MODULES="dialog sipmsgops sl tm rr maxfwd rtp.io rtpproxy textops" | |
SKIP_MODULES="usrloc event_routing clusterer rtp_relay" | |
mkdir tmp | |
cd modules | |
mv ${KEEP_MODULES} ${SKIP_MODULES} ../tmp | |
rm -rf * | |
cd ../tmp | |
mv ${KEEP_MODULES} ${SKIP_MODULES} ../modules | |
cd .. | |
rmdir tmp | |
EXCLUDE_MODULES_ADD="${SKIP_MODULES}" sh -x scripts/build/do_build.sh | |
- name: Build rtp.io module | |
run: | | |
apt-get install -y libsrtp2-dev | |
ONE_MODULE=rtp.io LDFLAGS=-flto CFLAGS=-flto sh -x scripts/build/do_build.sh | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Define PYTHON_CMD | |
run: | | |
PYTHON_VER="`echo ${{ env.PYTHON_VERSION }} | sed 's|-dev$||'`" | |
echo "PYTHON_CMD=python${PYTHON_VER}" >> $GITHUB_ENV | |
- name: Test rtp.io module | |
env: | |
MM_TYPE: opensips | |
MM_BRANCH: master | |
MM_ROOT: ../.. | |
RTPP_BRANCH: DOCKER | |
RTPPC_TYPE: rtp.io | |
RTPPROXY_DIST: ../../dist/rtpproxy | |
run: | | |
export CC="${COMPILER}" | |
cd dist/rtpproxy | |
./configure | |
cd ../../dist/voiptests | |
python -m pip install -r requirements.txt | |
DEBIAN_FRONTEND=noninteractive apt-get install -y gpp | |
sh -x ./test_run.sh | |
build_rtp_io_dock: | |
name: Build OpenSIPS+rtp.io Container | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
env: | |
BASE_IMAGE: ghcr.io/sippy/rtpproxy:latest-debian_12-slim | |
outputs: | |
test_matrix: ${{ steps.set-env.outputs.test_matrix }} | |
build_image: ${{ steps.set-env.outputs.build_image }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Checkout VoIPTests repo | |
uses: actions/checkout@v4 | |
with: | |
repository: 'sippy/voiptests' | |
path: dist/voiptests | |
- name: Checkout RTPProxy repo | |
uses: actions/checkout@v4 | |
with: | |
repository: 'sippy/rtpproxy' | |
path: dist/rtpproxy | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set dynamic environment | |
id: set-env | |
run: | | |
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \ | |
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \ | |
sort -u | grep -v unknown | paste -sd ','`" | |
echo "Platforms: ${PLATFORMS}" | |
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | |
BUILD_IMAGE="${{ env.GHCR_REPO }}:rtp.io-${GIT_BRANCH}" | |
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV | |
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV | |
echo "BUILD_IMAGE=${BUILD_IMAGE}" >> $GITHUB_ENV | |
TEST_MATRIX="`echo ${PLATFORMS} | tr ',' '\n' | jq -R . | jq -s . | tr '\n' ' '`" | |
echo "test_matrix=${TEST_MATRIX}" >> $GITHUB_OUTPUT | |
echo "build_image=${BUILD_IMAGE}" >> $GITHUB_OUTPUT | |
- name: Build Docker image | |
uses: docker/build-push-action@v6 | |
env: | |
CACHE_SPEC: "type=registry,ref=${{ env.BUILD_IMAGE }}-buildcache" | |
with: | |
context: . | |
file: ./docker/Dockerfile.rtp.io | |
build-args: | | |
BASE_IMAGE=${{ env.BASE_IMAGE }} | |
BUILD_OS=debian-12 | |
COMPILER=${{ env.COMPILER }} | |
COMPILER_OLD=${{ env.COMPILER_OLD }} | |
platforms: ${{ env.PLATFORMS }} | |
cache-from: ${{ env.CACHE_SPEC }} | |
cache-to: ${{ env.CACHE_SPEC }},mode=max | |
tags: ${{ env.BUILD_IMAGE }} | |
push: true | |
test_rtp_io_dock: | |
name: Test OpenSIPS+rtp.io | |
needs: build_rtp_io_dock | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
test_platform: ${{ fromJSON(needs.build_rtp_io_dock.outputs.test_matrix) }} | |
env: | |
PLATFORM: ${{ matrix.test_platform }} | |
BUILD_IMAGE: ${{ needs.build_rtp_io_dock.outputs.build_image }} | |
steps: | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ env.PLATFORM }} | |
- name: Test ${{ env.PLATFORM }} | |
run: | | |
docker pull ${BUILD_IMAGE} | |
docker run --platform ${PLATFORM} --name test --cap-add=SYS_PTRACE | |
--privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 ${BUILD_IMAGE} |