Skip to content

Generate ice_lite credentials with RAND_bytes() instead of random() #1754

Generate ice_lite credentials with RAND_bytes() instead of random()

Generate ice_lite credentials with RAND_bytes() instead of random() #1754

Workflow file for this run

name: RTPProxy CI
# 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:
schedule:
- cron: "0 0 * * 0"
permissions:
contents: write
# Cancels previous runs of this workflow for the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || startsWith(github.ref_name, 'codex/') || github.ref_name == 'wip' }}
env:
COVERALLS_REPORTER_VERSION: v0.6.22
jobs:
LoadJobs_conf:
name: Load Jobs Settings
uses: ./.github/workflows/.jobs_configure.yml
MinBuild:
name: Lean Build
needs: LoadJobs_conf
if: needs.LoadJobs_conf.outputs.do_MinBuild == 'true'
# The type of runner that the job will run on
runs-on: ubuntu-latest
container:
image: ubuntu:${{ matrix.os }}
options: >-
-v sources:/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
--sysctl net.ipv4.ip_unprivileged_port_start=1024 --init
env:
COMPILER: ${{ matrix.compiler }}
TAR_CMD: tar
GHA_OS: ubuntu-${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_MinBuild) }}
steps:
- name: Install git
run: |
apt-get update
apt-get install -y git lsb-release gnupg2 wget
- uses: actions/checkout@v7
with:
submodules: 'recursive'
- name: Start Docker container
if: endsWith(matrix.compiler, '-cross')
run: sh -x scripts/build/start_container.sh
- name: Cache apt-get packages
uses: actions/cache@v6
with:
path: /var/cache/apt/archives
key: cleanbuild-${{ matrix.os }}-apt-get-${{ github.run_id }}
restore-keys: |
cleanbuild-${{ matrix.os }}-apt-get
cleanbuild-${{ matrix.os }}-${{ matrix.compiler }}-apt-get
- name: Install apt-get updates
run: scripts/ft-apt-get-update.sh
- name: install_depends
run: sh -x scripts/build/install_depends.sh
- name: build
run: sh -x ./scripts/do-build.sh cleanbuild
BuildPackages:
name: Build Packages
needs: [LoadJobs_conf, FullBuild]
uses: sippy/cimagic/.github/workflows/BuildDPKGs.yml@v3
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_BuildPackages == 'true' &&
(needs.LoadJobs_conf.outputs.do_FullBuild != 'true' || needs.FullBuild.result == 'success') }}
with:
apt_depends: pkg-config libssl-dev libbcg729-dev libgsm1-dev libsndfile1-dev libunwind-dev libsrtp2-dev libsystemd-dev systemd procps
test_dpkgs_script: ./scripts/do-dpkg-test.sh
os_versions: '["ubuntu:26.04", "ubuntu:24.04", "ubuntu:22.04", "debian:13", "debian:12", "debian:11"]'
FullBuild:
name: Full Build
needs: [LoadJobs_conf, MinBuild]
if: ${{ !cancelled() && (needs.LoadJobs_conf.outputs.do_FullBuild == 'true' ||
needs.LoadJobs_conf.outputs.do_FuncTest == 'true' || needs.LoadJobs_conf.outputs.do_Glitch == 'true') &&
(needs.LoadJobs_conf.outputs.do_MinBuild != 'true' || needs.MinBuild.result == 'success') }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
COMPILER: ${{ matrix.compiler }}
TAR_CMD: tar
GHA_OS: ubuntu-${{ matrix.os }}
CI_IMAGE: ghcr.io/${{ github.repository }}:ci-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.compiler }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_FullBuild) }}
steps:
- uses: actions/checkout@v7
with:
submodules: 'recursive'
persist-credentials: false
- name: Build CI image with both test suites
run: |
docker build --file docker/Dockerfile.ci \
--build-arg BASE_IMAGE=ubuntu:${{ matrix.os }} \
--build-arg COMPILER=${{ matrix.compiler }} \
--label "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \
--tag rtpproxy-ci:tests .
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push CI image
if: github.event_name != 'pull_request'
run: |
docker tag rtpproxy-ci:tests "${CI_IMAGE}"
docker push "${CI_IMAGE}"
- name: Save CI image
if: github.event_name == 'pull_request'
run: |
docker image inspect rtpproxy-ci:tests --format 'Uncompressed CI image size: {{.Size}} bytes'
mkdir -p "${RUNNER_TEMP}/ci-image"
docker save rtpproxy-ci:tests | zstd -T0 -3 -c > "${RUNNER_TEMP}/ci-image/rtpproxy-ci.tar.zst"
du -h "${RUNNER_TEMP}/ci-image/rtpproxy-ci.tar.zst"
# PRs use artifacts so their builds do not need registry write access.
- name: Upload CI image for test jobs
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v7
with:
name: ci-image-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/ci-image/rtpproxy-ci.tar.zst
compression-level: 0
if-no-files-found: error
retention-days: 3
# Stable names also let failed-job reruns reuse an earlier build.
overwrite: true
FuncTest:
name: Functional Testing
needs: [LoadJobs_conf, FullBuild]
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_FuncTest == 'true' &&
needs.FullBuild.result == 'success' }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
env:
COMPILER: ${{ matrix.compiler }}
TAR_CMD: tar
GHA_OS: ubuntu-${{ matrix.os }}
CI_IMAGE: ghcr.io/${{ github.repository }}:ci-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.compiler }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_FuncTest) }}
steps:
- uses: actions/checkout@v7
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull CI image
if: github.event_name != 'pull_request'
run: |
docker pull "${CI_IMAGE}"
docker tag "${CI_IMAGE}" rtpproxy-ci:tests
- name: Download CI image
if: github.event_name == 'pull_request'
uses: actions/download-artifact@v8
with:
name: ci-image-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/ci-image
- name: Load CI image
if: github.event_name == 'pull_request'
run: docker load --input "${RUNNER_TEMP}/ci-image/rtpproxy-ci.tar.zst"
- name: Start CI image
run: |
sudo sysctl -w kernel.core_pattern=core
docker run --detach --name rtpproxy-tests --init \
--sysctl net.ipv4.ip_unprivileged_port_start=1024 \
--workdir /opt/rtpproxy/basic rtpproxy-ci:tests
- name: test
id: tests
run: docker exec rtpproxy-tests sh -x scripts/do-test.sh
- name: Collect coverage
run: |
docker exec rtpproxy-tests sh -x scripts/collect-coverage.sh
docker cp rtpproxy-tests:/opt/rtpproxy/basic/coverage .
sed -i "s|^SF:/opt/rtpproxy/basic/|SF:${GITHUB_WORKSPACE}/|" coverage/lcov.info
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: coverage-functional-${{ matrix.os }}-${{ matrix.compiler }}
path: coverage/lcov.info
overwrite: true
retention-days: 1
- name: Copy test results
if: ${{ always() && steps.tests.outcome != 'skipped' }}
run: docker cp rtpproxy-tests:/opt/rtpproxy/basic/tests/test-suite.log tests/test-suite.log
- name: Collect test summary
id: summary
if: ${{ always() }}
env:
TEST_OUTCOME: ${{ steps.tests.outcome }}
run: python3 scripts/test-summary.py collect --suite functional --output "${RUNNER_TEMP}/test-summary.json"
- name: Upload test summary
if: ${{ always() && steps.summary.outcome == 'success' }}
uses: actions/upload-artifact@v7
with:
name: test-summary-${{ github.run_attempt }}-functional-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/test-summary.json
- name: Remove test container
if: ${{ always() }}
run: docker rm --force rtpproxy-tests 2>/dev/null || true
Glitching:
name: Glitch Injection
needs: [LoadJobs_conf, FullBuild, FuncTest]
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_Glitch == 'true' && needs.FullBuild.result == 'success' &&
(needs.LoadJobs_conf.outputs.do_FuncTest != 'true' || needs.FuncTest.result == 'success') }}
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
env:
COMPILER: ${{ matrix.compiler }}
TAR_CMD: tar
GHA_OS: ubuntu-${{ matrix.os }}
CI_IMAGE: ghcr.io/${{ github.repository }}:ci-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.compiler }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_Glitching) }}
steps:
- uses: actions/checkout@v7
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull CI image
if: github.event_name != 'pull_request'
run: |
docker pull "${CI_IMAGE}"
docker tag "${CI_IMAGE}" rtpproxy-ci:tests
- name: Download CI image
if: github.event_name == 'pull_request'
uses: actions/download-artifact@v8
with:
name: ci-image-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/ci-image
- name: Load CI image
if: github.event_name == 'pull_request'
run: docker load --input "${RUNNER_TEMP}/ci-image/rtpproxy-ci.tar.zst"
- name: Start CI image
run: |
sudo sysctl -w kernel.core_pattern=core
docker run --detach --name rtpproxy-tests --init \
--sysctl net.ipv4.ip_unprivileged_port_start=1024 \
--security-opt seccomp=unconfined \
--workdir /opt/rtpproxy/glitching rtpproxy-ci:tests
- name: test
id: tests
run: docker exec rtpproxy-tests sh -x scripts/do-test.sh
- name: Collect coverage
run: |
docker exec rtpproxy-tests sh -x scripts/collect-coverage.sh
docker cp rtpproxy-tests:/opt/rtpproxy/glitching/coverage .
sed -i "s|^SF:/opt/rtpproxy/glitching/|SF:${GITHUB_WORKSPACE}/|" coverage/lcov.info
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: coverage-glitching-${{ matrix.os }}-${{ matrix.compiler }}
path: coverage/lcov.info
overwrite: true
retention-days: 1
- name: Copy test results
if: ${{ always() && steps.tests.outcome != 'skipped' }}
run: docker cp rtpproxy-tests:/opt/rtpproxy/glitching/tests/test-suite.log tests/test-suite.log
- name: Collect test summary
id: summary
if: ${{ always() }}
env:
TEST_OUTCOME: ${{ steps.tests.outcome }}
run: python3 scripts/test-summary.py collect --suite glitching --output "${RUNNER_TEMP}/test-summary.json"
- name: Upload test summary
if: ${{ always() && steps.summary.outcome == 'success' }}
uses: actions/upload-artifact@v7
with:
name: test-summary-${{ github.run_attempt }}-glitching-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/test-summary.json
- name: Collect glitch failure logs
id: glitch_logs
if: ${{ failure() && !cancelled() }}
run: |
if docker exec rtpproxy-tests sh -c \
'test -n "$(find /tmp -maxdepth 1 -type d -name "glitch.*" -print -quit)"'
then
docker exec rtpproxy-tests sh -c \
'cd /tmp && find . -maxdepth 1 -type d -name "glitch.*" -print0 | tar --null -T - -czf -' \
> "${RUNNER_TEMP}/glitch-failures.tar.gz"
echo 'present=true' >> "${GITHUB_OUTPUT}"
fi
- name: Upload glitch failure logs
if: ${{ failure() && !cancelled() && steps.glitch_logs.outputs.present == 'true' }}
uses: actions/upload-artifact@v7
with:
name: glitch-failures-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/glitch-failures.tar.gz
- name: Remove test container
if: ${{ always() }}
run: docker rm --force rtpproxy-tests 2>/dev/null || true
TestSummary:
name: Combined Test Summary
needs: [FuncTest, Glitching]
if: ${{ always() && !cancelled() && (needs.FuncTest.result != 'skipped' || needs.Glitching.result != 'skipped') }}
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- uses: actions/checkout@v7
- name: Download test summaries
uses: actions/download-artifact@v8
with:
pattern: test-summary-*
path: ${{ runner.temp }}/test-results
- name: Publish combined test summary
if: ${{ always() }}
env:
TEST_RESULTS: ${{ toJSON(needs) }}
GH_TOKEN: ${{ github.token }}
run: |
delay=5
for attempt in 1 2 3 4 5; do
if gh api --paginate --slurp \
"repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs?filter=latest&per_page=100" \
> "${RUNNER_TEMP}/test-jobs.json"
then
break
else
status=$?
fi
if [ "$attempt" -eq 5 ]; then
echo "::error::Failed to fetch test jobs after ${attempt} attempts"
exit "$status"
fi
echo "::warning::Failed to fetch test jobs (attempt ${attempt}/5); retrying in ${delay}s"
sleep "$delay"
delay=$((delay * 2))
done
python3 scripts/test-summary.py render --jobs "${RUNNER_TEMP}/test-jobs.json" --results "${RUNNER_TEMP}/test-results" >> "$GITHUB_STEP_SUMMARY"
Fuzzing:
name: Fuzz with OSS-Fuzz
needs: [LoadJobs_conf, Glitching]
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_Fuzzing == 'true' &&
(needs.LoadJobs_conf.outputs.do_Glitch != 'true' || needs.Glitching.result == 'success') }}
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
sanitizer: [address, undefined, memory, coverage]
steps:
- uses: actions/checkout@v7
with:
submodules: 'recursive'
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'rtpproxy'
dry-run: false
language: c
sanitizer: ${{ matrix.sanitizer }}
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
env:
OF_SANITIZER: ${{ matrix.sanitizer }}
with:
oss-fuzz-project-name: 'rtpproxy'
fuzz-seconds: 1200
dry-run: false
parallel-fuzzing: true
language: c
sanitizer: ${{ matrix.sanitizer }}
output-sarif: true
- name: Collect fuzzing coverage
if: matrix.sanitizer == 'coverage'
run: sh -x scripts/fuzz/collect-coverage.sh
- name: Upload fuzzing coverage report
if: matrix.sanitizer == 'coverage'
uses: actions/upload-artifact@v7
with:
name: fuzzing-coverage
path: coverage/lcov.info
overwrite: true
retention-days: 1
- name: Upload Crash
uses: actions/upload-artifact@v7
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts
path: ./out/artifacts
- name: Upload Sarif
if: always() && steps.build.outcome == 'success' && matrix.sanitizer != 'coverage'
uses: github/codeql-action/upload-sarif@v4
with:
# Path to SARIF file relative to the root of the repository
sarif_file: cifuzz-sarif/results.sarif
checkout_path: cifuzz-sarif
# Fetch the Coveralls reporter once per version, so that the coverage jobs
# restore it from the cache instead of all hitting GitHub releases at once.
CoverallsReporter:
name: Cache Coveralls Reporter
needs: LoadJobs_conf
if: ${{ needs.LoadJobs_conf.outputs.do_FuncTest == 'true' ||
needs.LoadJobs_conf.outputs.do_Glitch == 'true' ||
needs.LoadJobs_conf.outputs.do_Fuzzing == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Look up Coveralls reporter
id: cache
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
lookup-only: true
- uses: actions/checkout@v7
if: steps.cache.outputs.cache-hit != 'true'
- name: Download Coveralls reporter
if: steps.cache.outputs.cache-hit != 'true'
run: sh -x scripts/install-coveralls.sh "${COVERALLS_REPORTER_VERSION}" "${RUNNER_TEMP}/coveralls"
- name: Save Coveralls reporter
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
Coverage:
name: Upload Coverage
needs: [LoadJobs_conf, CoverallsReporter, FuncTest, Glitching]
if: ${{ !cancelled() && (needs.FuncTest.result != 'skipped' ||
needs.Glitching.result != 'skipped') }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.LoadJobs_conf.outputs.matrix_FullBuild) }}
steps:
- uses: actions/checkout@v7
- name: Download coverage reports
uses: actions/download-artifact@v8
with:
pattern: coverage-*-${{ matrix.os }}-${{ matrix.compiler }}
path: ${{ runner.temp }}/coverage
# Add up all test suites run with this build, so that its branches are
# counted together in one upload.
- name: Merge coverage reports
id: merge
run: |
set -- "${RUNNER_TEMP}"/coverage/*/lcov.info
if [ ! -e "${1}" ]
then
echo "No coverage reports for this build"
exit 0
fi
mkdir -p coverage
python3 scripts/merge-coverage-branches.py --drop-declarations \
-o coverage/lcov.info "${@}"
# Branches of different compilers do not match up: they only get to
# Coveralls through the fuzzing report, blended into its own ones.
python3 scripts/merge-coverage-branches.py --no-branches \
-o coverage/coveralls.info coverage/lcov.info
echo 'present=true' >> "${GITHUB_OUTPUT}"
- name: Upload merged coverage report
if: steps.merge.outputs.present == 'true'
uses: actions/upload-artifact@v7
with:
name: merged-coverage-${{ matrix.os }}-${{ matrix.compiler }}
path: coverage/lcov.info
overwrite: true
retention-days: 1
- name: Restore Coveralls reporter
if: steps.merge.outputs.present == 'true'
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
fail-on-cache-miss: true
- name: Upload coverage to Coveralls
if: steps.merge.outputs.present == 'true'
env:
TZ: UTC
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: tests-${{ matrix.os }}-${{ matrix.compiler }}
COVERALLS_PARALLEL: true
COVERALLS_SOURCE_HEADER: github-action
run: '"${RUNNER_TEMP}/coveralls/coveralls" report --format lcov coverage/coveralls.info'
FuzzCoverage:
name: Upload Fuzzing Coverage
needs: [CoverallsReporter, Coverage, Fuzzing]
if: ${{ !cancelled() && needs.Fuzzing.result != 'skipped' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- name: Download coverage reports
uses: actions/download-artifact@v8
with:
pattern: '{fuzzing,merged}-coverage*'
path: ${{ runner.temp }}/coverage
# Source-based fuzzing coverage does not match the tests' gcov records.
# Keep its own records and count what the tests covered in them.
- name: Blend test coverage into fuzzing coverage
id: merge
run: |
FUZZ="${RUNNER_TEMP}/coverage/fuzzing-coverage/lcov.info"
if [ ! -e "${FUZZ}" ]
then
echo "No fuzzing coverage report"
exit 0
fi
sed -i "s|^SF:\([^/]\)|SF:${GITHUB_WORKSPACE}/\1|" "${FUZZ}"
set --
for report in "${RUNNER_TEMP}"/coverage/merged-coverage-*/lcov.info
do
if [ -e "${report}" ]
then
set -- "${@}" --blend "${report}"
fi
done
mkdir -p coverage
python3 scripts/merge-coverage-branches.py --drop-declarations \
-o coverage/lcov.info "${@}" "${FUZZ}"
echo 'present=true' >> "${GITHUB_OUTPUT}"
- name: Restore Coveralls reporter
if: steps.merge.outputs.present == 'true'
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
fail-on-cache-miss: true
- name: Upload fuzzing coverage to Coveralls
if: steps.merge.outputs.present == 'true'
env:
TZ: UTC
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: fuzzing-coverage
COVERALLS_PARALLEL: true
COVERALLS_SOURCE_HEADER: github-action
run: '"${RUNNER_TEMP}/coveralls/coveralls" report --format lcov coverage/lcov.info'
FinishCoverage:
name: Finish Coveralls Build
needs: [CoverallsReporter, Coverage, FuzzCoverage]
if: ${{ always() && (needs.Coverage.result != 'skipped' ||
needs.FuzzCoverage.result != 'skipped') }}
runs-on: ubuntu-latest
steps:
- name: Restore Coveralls reporter
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/coveralls
key: coveralls-reporter-linux-x86_64-${{ env.COVERALLS_REPORTER_VERSION }}
fail-on-cache-miss: true
- name: Complete parallel coverage build
env:
TZ: UTC
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SOURCE_HEADER: github-action
run: '"${RUNNER_TEMP}/coveralls/coveralls" done'
Docker:
name: Build&Push to DockerHub
needs: [LoadJobs_conf, Fuzzing]
if: ${{ !cancelled() && needs.LoadJobs_conf.outputs.do_Docker == 'true' &&
(needs.LoadJobs_conf.outputs.do_Fuzzing != 'true' || needs.Fuzzing.result == 'success') &&
(github.event_name == 'push' || github.event_name == 'pull_request') }}
runs-on: ubuntu-latest
permissions:
packages: write
services:
registry:
image: registry:2
ports:
- 5000:5000
env:
CLANG_VER_NEW: 19
CLANG_VER_OLD: 19
DOCKER_REPO: sippylabs/rtpproxy
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/rtpproxy
LOCAL_REPO: localhost:5000/sippylabs/rtpproxy
BASE_IMAGE: ${{ matrix.base_image }}
CCACHE_ROOT: ccache
DOCKER_RW: ${{ ( github.repository == 'sippy/rtpproxy' && github.event_name != 'pull_request' ) && 'true' || 'false' }}
CCACHE_BIN_IMAGE: ghcr.io/sobomax/ccache:${{ matrix.ccache_bin_image }}
strategy:
fail-fast: false
matrix:
include:
- base_image: 'debian:12-slim'
ccache_bin_image: 'latest-debian-12'
- base_image: 'debian:13-slim'
ccache_bin_image: 'latest-debian-13'
- base_image: 'ubuntu:24.04'
ccache_bin_image: 'latest-ubuntu-24.04'
- base_image: 'ubuntu:latest'
ccache_bin_image: 'latest-ubuntu-26.04'
steps:
- name: Maximize build space
shell: sh -x -e {0}
run: |
echo "Memory and swap:"
sudo free -h
echo
sudo swapon --show
echo
echo "Available storage:"
sudo df -h
echo
PIDS=""
for d in /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
do
sudo rm -rf "${d}" &
PIDS="${PIDS} ${!}"
done
sudo docker image prune --all --force &
PIDS="${PIDS} ${!}"
for pid in ${PIDS}
do
wait ${pid}
done
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: 'recursive'
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
driver-opts: network=host
- name: Log in to Docker Hub
if: env.DOCKER_RW == 'true'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set dynamic environment
run: |
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
GIT_BRANCH="${GIT_BRANCH#refs/tags/}"
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV
OS_TAG="`echo ${BASE_IMAGE} | sed 's|:|_|g'`"
BRANCH_TAG="`echo ${GIT_BRANCH} | sed 's|/|_|g'`"
if [ "${DOCKER_RW}" = "true" ]
then
CCACHE_IMAGE="${{ env.GHCR_REPO }}:${BRANCH_TAG}-${OS_TAG}-cccache"
else
CCACHE_IMAGE="${{ env.GHCR_REPO }}:master-${OS_TAG}-cccache"
fi
CACHE_SPEC="type=registry,ref=${CCACHE_IMAGE}"
echo "CACHE_SPEC=${CACHE_SPEC}" >> $GITHUB_ENV
if ! docker pull ${CCACHE_IMAGE} 2>&1 >/dev/null
then
CCACHE_BIMAGE="scratch"
else
CCACHE_BIMAGE="${CCACHE_IMAGE}"
fi
docker pull ${CCACHE_BIN_IMAGE}
echo "BRANCH_TAG=${BRANCH_TAG}" >> $GITHUB_ENV
echo "CCACHE_IMAGE=${CCACHE_IMAGE}" >> $GITHUB_ENV
echo "CCACHE_BIMAGE=${CCACHE_BIMAGE}" >> $GITHUB_ENV
echo "BUILD_IMAGE=${{ env.LOCAL_REPO }}:latest-${OS_TAG}" >> $GITHUB_ENV
echo "LIBG722_IMAGE=sippylabs/libg722:latest-${OS_TAG}" >> $GITHUB_ENV
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
grep -v unknown | sort -u | paste -sd ','`"
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
echo "OS_TAG=${OS_TAG}" >> $GITHUB_ENV
if [[ "${{ matrix.base_image }}" == debian:12* ]]
then
echo "LIBSSL_APKG=libssl3" >> $GITHUB_ENV
else
echo "LIBSSL_APKG=libssl3t64" >> $GITHUB_ENV
fi
if [ "${{ matrix.base_image }}" = "ubuntu:latest" -a "${{ github.ref_name }}" = "${{ github.event.repository.default_branch }}" ]
then
echo "ADD_LATEST=true" >> "$GITHUB_ENV"
else
echo "ADD_LATEST=false" >> "$GITHUB_ENV"
fi
- name: Extract metadata (tags, labels) for Docker
id: meta_dkr
uses: docker/metadata-action@v6
with:
images: ${{ env.DOCKER_REPO }}
tags: |
type=schedule,suffix=-${{ env.OS_TAG }}
type=ref,event=branch,suffix=-${{ env.OS_TAG }}
type=ref,event=tag,suffix=-${{ env.OS_TAG }}
type=ref,event=pr,suffix=-${{ env.OS_TAG }}
type=raw,value=latest-${{ env.OS_TAG }},enable={{is_default_branch}}
type=sha,suffix=-${{ env.OS_TAG }}
type=raw,value=latest,enable=${{ env.ADD_LATEST == 'true' }}
- name: Extract metadata (tags, labels) for GHCR
id: meta_ghcr
uses: docker/metadata-action@v6
with:
images: ${{ env.GHCR_REPO }}
tags: |
type=schedule,suffix=-${{ env.OS_TAG }}
type=ref,event=branch,suffix=-${{ env.OS_TAG }}
type=ref,event=tag,suffix=-${{ env.OS_TAG }}
type=ref,event=pr,suffix=-${{ env.OS_TAG }}
type=raw,value=latest-${{ env.OS_TAG }},enable={{is_default_branch}}
type=sha,suffix=-${{ env.OS_TAG }}
type=raw,value=latest,enable=${{ env.ADD_LATEST == 'true' }}
- name: Build Docker image
if: env.DOCKER_RW == 'true'
uses: docker/build-push-action@v7
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: ./docker/Dockerfile
build-args: |
CLANG_VER_OLD=${{ env.CLANG_VER_OLD }}
CLANG_VER_NEW=${{ env.CLANG_VER_NEW }}
BASE_IMAGE=${{ env.BASE_IMAGE }}
LIBG722_IMAGE=${{ env.LIBG722_IMAGE }}
CCACHE_IMAGE=${{ env.CCACHE_BIMAGE }}
CCACHE_BIN_IMAGE=${{ env.CCACHE_BIN_IMAGE }}
CCACHE_ROOT=${{ env.CCACHE_ROOT }}
LIBSSL_APKG=${{ env.LIBSSL_APKG }}
tags: ${{ env.BUILD_IMAGE }}
platforms: ${{ env.PLATFORMS }}
push: true
cache-from: ${{ env.CACHE_SPEC }}
cache-to: ${{ env.CACHE_SPEC }},mode=max
- name: Build Docker image (PR)
if: env.DOCKER_RW != 'true'
uses: docker/build-push-action@v7
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: ./docker/Dockerfile
build-args: |
CLANG_VER_OLD=${{ env.CLANG_VER_OLD }}
CLANG_VER_NEW=${{ env.CLANG_VER_NEW }}
BASE_IMAGE=${{ env.BASE_IMAGE }}
LIBG722_IMAGE=${{ env.LIBG722_IMAGE }}
CCACHE_IMAGE=${{ env.CCACHE_BIMAGE }}
CCACHE_BIN_IMAGE=${{ env.CCACHE_BIN_IMAGE }}
CCACHE_ROOT=${{ env.CCACHE_ROOT }}
LIBSSL_APKG=${{ env.LIBSSL_APKG }}
tags: ${{ env.BUILD_IMAGE }}
platforms: ${{ env.PLATFORMS }}
push: true
cache-from: ${{ env.CACHE_SPEC }}
- name: Export ccache
if: env.DOCKER_RW == 'true'
uses: docker/build-push-action@v7
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
file: ./docker/Dockerfile.export_ccache
build-args: BUILD_IMAGE=${{ env.BUILD_IMAGE }}
tags: ${{ env.CCACHE_IMAGE }}
platforms: ${{ env.PLATFORMS }}
push: true
- name: Push Docker image
if: env.DOCKER_RW == 'true'
uses: docker/build-push-action@v7
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
file: ./docker/Dockerfile.push
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
BUILD_IMAGE=${{ env.BUILD_IMAGE }}
push: true
tags: |
${{ steps.meta_dkr.outputs.tags }}
${{ steps.meta_ghcr.outputs.tags }}
labels: |
${{ steps.meta_dkr.outputs.labels }}
${{ steps.meta_ghcr.outputs.labels }}
platforms: ${{ env.PLATFORMS }}
- name: Update DockerHub repo description
if: env.DOCKER_RW == 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: sh -x docker/update_description.sh docker/README.md
roll_release:
name: Roll Release
needs: [LoadJobs_conf, Docker, BuildPackages]
permissions:
contents: write
uses: sippy/cimagic/.github/workflows/RollReleaseDraft.yml@v3
with:
release_files_artifacts: |
${{ needs.BuildPackages.outputs.dpkgs_artifacts }}