Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Oct 15, 2024
1 parent 7d28303 commit 7d8f9f3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 31 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/rtp.io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:
workflow_dispatch:

env:
COMPILER: clang-18
COMPILER_OLD: clang-16
LLVM_VER: 18
LLVM_VER_OLD: 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
Expand All @@ -30,7 +30,9 @@ jobs:
BUILD_OS: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Set up environment
run: echo "COMPILER=clang-${LLVM_VER}" >> $GITHUB_ENV

- name: Install git
run: |
apt-get update
Expand Down Expand Up @@ -110,6 +112,7 @@ jobs:
packages: write
env:
BASE_IMAGE: ghcr.io/sippy/rtpproxy:latest-debian_12-slim
BUILD_OS: debian-12
outputs:
test_matrix: ${{ steps.set-env.outputs.test_matrix }}
build_image: ${{ steps.set-env.outputs.build_image }}
Expand Down Expand Up @@ -150,7 +153,7 @@ jobs:
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 ','`"
sort -u | grep -v unknown | ./scripts/build/get-arch-buildargs.rtp.io fltplatforms | paste -sd ','`"
echo "Platforms: ${PLATFORMS}"
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
BUILD_IMAGE="${{ env.GHCR_REPO }}:rtp.io-${GIT_BRANCH}"
Expand All @@ -170,9 +173,9 @@ jobs:
file: ./docker/Dockerfile.rtp.io
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
BUILD_OS=debian-12
COMPILER=${{ env.COMPILER }}
COMPILER_OLD=${{ env.COMPILER_OLD }}
BUILD_OS=${{ env.BUILD_OS }}
LLVM_VER=${{ env.LLVM_VER }}
LLVM_VER_OLD=${{ env.LLVM_VER_OLD }}
platforms: ${{ env.PLATFORMS }}
cache-from: ${{ env.CACHE_SPEC }}
cache-to: ${{ env.CACHE_SPEC }},mode=max
Expand Down Expand Up @@ -201,5 +204,5 @@ jobs:
- name: Test ${{ env.PLATFORM }}
run: |
docker pull ${BUILD_IMAGE}
docker run --platform ${PLATFORM} --name test --cap-add=SYS_PTRACE
docker run --platform ${PLATFORM} --name test --cap-add=SYS_PTRACE \
--privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 ${BUILD_IMAGE}
2 changes: 1 addition & 1 deletion Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ endif #ARCH, sparc64
#if ipaq/netwinder
ifeq ($(ARCH), arm)
# if gcc
ifeq ($(CC_NAME), gcc)
ifeq ($(CC_NAME:clang=gcc), gcc)
#common stuff
CFLAGS+=$(CC_OPTIMIZE_FLAG) -funroll-loops -Wcast-align $(PROFILE) \
-Wall -marm
Expand Down
19 changes: 9 additions & 10 deletions docker/Dockerfile.rtp.io
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /src

ARG COMPILER=clang-18
ARG COMPILER_OLD=clang-16
ARG LLVM_VER=18
ARG LLVM_VER_OLD=16
ARG TARGETPLATFORM
ARG BUILD_OS=ubuntu-latest
RUN --mount=type=bind,source=scripts/build,target=scripts/build \
scripts/build/get-arch-buildargs.rtp.io platformopts
RUN --mount=type=bind,source=scripts/build,target=scripts/build \
env `scripts/build/get-arch-buildargs.rtp.io platformopts` \
env `./scripts/build/get-arch-buildargs.rtp.io platformopts` \
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 \
Expand All @@ -33,15 +31,16 @@ 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}" \
env `scripts/build/get-arch-buildargs.rtp.io platformopts` \
env `./scripts/build/get-arch-buildargs.rtp.io platformopts` \
sh -x scripts/build/do_build.sh
RUN apt-get install -y libsrtp2-dev lld-18
RUN eval `./scripts/build/get-arch-buildargs.rtp.io platformopts` && \
apt-get install -y libsrtp2-dev ${LINKER}
RUN env ONE_MODULE=rtp.io LDFLAGS="-flto -fuse-ld=lld" CFLAGS=-flto \
env `scripts/build/get-arch-buildargs.rtp.io platformopts` \
env `./scripts/build/get-arch-buildargs.rtp.io platformopts` \
sh -x scripts/build/do_build.sh
ARG CC=${COMPILER}
COPY --exclude=.git --exclude=.github dist/rtpproxy dist/rtpproxy
RUN cd dist/rtpproxy && ./configure
RUN eval `./scripts/build/get-arch-buildargs.rtp.io platformopts` && \
cd dist/rtpproxy && CC="${COMPILER}" ./configure

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

Expand Down
4 changes: 2 additions & 2 deletions scripts/build/do_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ MAKE_CMD="${MAKE_ENV} make"

if [ ! -z "${ONE_MODULE}" ]
then
env CC_EXTRA_OPTS="${CC_EXTRA_OPTS:-"-Werror"}" ${MAKE_CMD} \
env CC_EXTRA_OPTS="${CC_EXTRA_OPTS:-"-Werror -Wno-atomic-alignment"}" ${MAKE_CMD} \
-C "modules/${ONE_MODULE}"
else
env CC_EXTRA_OPTS="${CC_EXTRA_OPTS:-"-Werror"}" ${MAKE_CMD} \
env CC_EXTRA_OPTS="${CC_EXTRA_OPTS:-"-Werror -Wno-atomic-alignment"}" ${MAKE_CMD} \
exclude_modules="${EXCLUDE_MODULES}" "${@}" ${MAKE_TGT:-"all"}
fi
16 changes: 6 additions & 10 deletions scripts/build/get-arch-buildargs.rtp.io
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
#!/bin/sh

set -e
set -x

fltplatforms() {
case "${BASE_IMAGE}" in
alpine:3.15)
FILT="grep -v -e ^linux/arm/v6\$" # bus error
;;
ubuntu:20.04)
FILT="grep -v -e ^linux/arm/v7\$" # broken cmake
case "${BUILD_OS}" in
debian*)
FILT="grep -v -e ^linux/arm/v5\$" # broken 64-bit stdatomics
;;
*)
FILT="cat"
Expand All @@ -19,20 +15,20 @@ fltplatforms() {
}

platformopts() {
out="COMPILER=clang-${LLVM_VER} LINKER=lld-${LLVM_VER}"
case "${BUILD_OS}" in
debian*)
case "${TARGETPLATFORM}" in
linux/ppc64le | linux/arm/v7 | linux/mips64le | linux/arm/v5)
echo "COMPILER=${COMPILER_OLD}"
out="COMPILER=clang-${LLVM_VER_OLD} LINKER=lld-${LLVM_VER_OLD}"
;;
esac
;;
esac
echo "${out}"
echo "${@}"
}

echo "BUILD_OS=${BUILD_OS} TARGETPLATFORM=${TARGETPLATFORM}" >&2

case "${1}" in
platformopts)
shift
Expand Down

0 comments on commit 7d8f9f3

Please sign in to comment.