Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Oct 11, 2024
1 parent b6e5577 commit 1f4e858
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 11 deletions.
61 changes: 55 additions & 6 deletions .github/workflows/rtp.io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
COMPILER: clang-18
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:
Expand All @@ -21,9 +25,8 @@ jobs:
image: sippylabs/rtpproxy:latest
options: --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0
env:
COMPILER: clang-18
BUILD_OS: ubuntu-latest
PYTHON_VERSION: 3.12
BUILD_OS: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand Down Expand Up @@ -99,13 +102,15 @@ jobs:
DEBIAN_FRONTEND=noninteractive apt-get install -y gpp
sh -x ./test_run.sh
build_test_rtp_io_dock:
build_rtp_io_dock:
runs-on: ubuntu-latest
permissions:
packages: write
env:
BASE_IMAGE: ghcr.io/sippy/rtpproxy:latest
COMPILER: clang-18
BUILD_OS: ubuntu-latest
PYTHON_VERSION: 3.12
outputs:
test_matrix: ${{ steps.set-env.outputs.test_matrix }}
build_image: ${{ steps.set-env.outputs.build_image }}

steps:
- uses: actions/checkout@v4
Expand All @@ -131,19 +136,63 @@ jobs:
- 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 }}
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:
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 -it --platform ${PLATFORM} --name test --cap-add=SYS_PTRACE --privileged ${BUILD_IMAGE}
29 changes: 24 additions & 5 deletions docker/Dockerfile.rtp.io
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,40 @@ USER root
# Set Environment Variables
ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /tmp
WORKDIR /src

ARG COMPILER=clang-18
ARG BUILD_OS=ubuntu-latest
RUN --mount=type=bind,source=scripts/build,target=scripts/build \
sh -x scripts/build/install_depends.sh
RUN apt-get install -y gpp python-is-python3 python3-pip
RUN --mount=type=bind,source=dist/voiptests/requirements.txt,target=requirements.txt \
python -m pip install --break-system-packages -U -r requirements.txt

COPY --exclude=.git --exclude=.github . .

RUN pwd
RUN ls -l
COPY --exclude=.git --exclude=.github --exclude=docker --exclude=dist \
. .

ARG KEEP_MODULES="dialog sipmsgops sl tm rr maxfwd rtp.io rtpproxy textops"
ARG SKIP_MODULES="usrloc event_routing clusterer rtp_relay"
RUN mkdir tmp && cd modules && mv ${KEEP_MODULES} ${SKIP_MODULES} ../tmp && \
rm -rf * && cd ../tmp && mv ${KEEP_MODULES} ${SKIP_MODULES} ../modules && \
cd .. && rmdir tmp
RUN EXCLUDE_MODULES_ADD="${SKIP_MODULES}" sh -x scripts/build/do_build.sh
RUN apt-get install -y libsrtp2-dev lld-18
RUN env ONE_MODULE=rtp.io LDFLAGS="-flto -fuse-ld=lld" CFLAGS=-flto \
sh -x scripts/build/do_build.sh
ARG CC=${COMPILER}
COPY --exclude=.git --exclude=.github dist/rtpproxy dist/rtpproxy
RUN cd dist/rtpproxy && ./configure

COPY --exclude=.git --exclude=.github dist/voiptests dist/voiptests

ENV MM_TYPE=opensips
ENV MM_BRANCH=master
ENV MM_ROOT=../..
ENV RTPP_BRANCH=DOCKER
ENV RTPPC_TYPE=rtp.io
ENV RTPPROXY_DIST=../../dist/rtpproxy
ENV ALICE_ARGS="-4"
WORKDIR dist/voiptests
ENTRYPOINT [ "sh", "-x", "./test_run.sh" ]

0 comments on commit 1f4e858

Please sign in to comment.