Skip to content

Commit c5e495a

Browse files
committed
Use container: + image: vs runs-on.
1 parent 3581547 commit c5e495a

6 files changed

Lines changed: 80 additions & 82 deletions

File tree

.github/workflows/rtpproxy_ci.yml

Lines changed: 45 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ jobs:
3030
needs: LoadJobs_conf
3131
if: needs.LoadJobs_conf.outputs.do_MinBuild == 'true'
3232
# The type of runner that the job will run on
33-
runs-on: ubuntu-${{ matrix.os }}
33+
runs-on: ubuntu-latest
34+
container:
35+
image: ubuntu:${{ matrix.os }}
36+
options: >-
37+
-v sources:/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
3438
env:
3539
COMPILER: ${{ matrix.compiler }}
36-
TAR_CMD: tar_nosuid
40+
TAR_CMD: tar
3741
GHA_OS: ubuntu-${{ matrix.os }}
3842

3943
strategy:
@@ -66,6 +70,11 @@ jobs:
6670
compiler: 'clang'
6771

6872
steps:
73+
- name: Install git
74+
run: |
75+
apt-get update
76+
apt-get install -y git lsb-release gnupg2 wget
77+
6978
- uses: actions/checkout@v6
7079
with:
7180
submodules: 'recursive'
@@ -74,14 +83,7 @@ jobs:
7483
if: endsWith(matrix.compiler, '-cross')
7584
run: sh -x scripts/build/start_container.sh
7685

77-
- name: Workaround for tar not being able to access /var/cache/apt/archives
78-
if: endsWith(matrix.compiler, '-cross') == 0
79-
run: |
80-
sudo cp "$(command -v tar)" "$(command -v tar)"_nosuid
81-
sudo chmod u+s "$(command -v tar)"
82-
8386
- name: Cache apt-get packages
84-
if: endsWith(matrix.compiler, '-cross') == 0
8587
uses: actions/cache@v5
8688
with:
8789
path: /var/cache/apt/archives
@@ -93,12 +95,6 @@ jobs:
9395
- name: Install apt-get updates
9496
run: scripts/ft-apt-get-update.sh
9597

96-
- name: Set up Python
97-
if: endsWith(matrix.compiler, '-cross') == 0
98-
uses: actions/setup-python@v6
99-
with:
100-
python-version: 3.9
101-
10298
- name: install_depends
10399
run: sh -x scripts/build/install_depends.sh
104100

@@ -114,17 +110,22 @@ jobs:
114110
with:
115111
apt_depends: pkg-config libssl-dev libbcg729-dev libgsm1-dev libsndfile1-dev libunwind-dev libsrtp2-dev libsystemd-dev systemd procps
116112
test_dpkgs_script: ./scripts/do-dpkg-test.sh
113+
os_versions: '["ubuntu:26.04", "ubuntu:24.04", "ubuntu:22.04", "debian:13", "debian:12", "debian:11"]'
117114

118115
FullBuild:
119116
name: Full Build
120117
needs: [LoadJobs_conf, MinBuild]
121118
if: ${{ !cancelled() && (success() || failure()) && needs.LoadJobs_conf.outputs.do_FullBuild == 'true' &&
122119
(needs.LoadJobs_conf.outputs.do_MinBuild != 'true' || needs.MinBuild.result == 'success') }}
123120
# The type of runner that the job will run on
124-
runs-on: ubuntu-${{ matrix.os }}
121+
runs-on: ubuntu-latest
122+
container:
123+
image: ubuntu:${{ matrix.os }}
124+
options: >-
125+
-v sources:/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
125126
env:
126127
COMPILER: ${{ matrix.compiler }}
127-
TAR_CMD: tar_nosuid
128+
TAR_CMD: tar
128129
GHA_OS: ubuntu-${{ matrix.os }}
129130

130131
strategy:
@@ -155,20 +156,15 @@ jobs:
155156
compiler: 'clang'
156157

157158
steps:
159+
- name: Install git
160+
run: |
161+
apt-get update
162+
apt-get install -y git lsb-release gnupg2 wget
163+
158164
- uses: actions/checkout@v6
159165
with:
160166
submodules: 'recursive'
161167

162-
- name: Start Docker container
163-
if: endsWith(matrix.compiler, '-cross')
164-
run: sh -x scripts/build/start_container.sh
165-
166-
- name: Workaround for tar not being able to access /var/cache/apt/archives
167-
if: endsWith(matrix.compiler, '-cross') == 0
168-
run: |
169-
sudo cp "$(command -v tar)" "$(command -v tar)"_nosuid
170-
sudo chmod u+s "$(command -v tar)"
171-
172168
- name: Cache apt-get packages
173169
if: endsWith(matrix.compiler, '-cross') == 0
174170
uses: actions/cache@v5
@@ -182,12 +178,6 @@ jobs:
182178
- name: Install apt-get updates
183179
run: scripts/ft-apt-get-update.sh
184180

185-
- name: Set up Python
186-
if: endsWith(matrix.compiler, '-cross') == 0
187-
uses: actions/setup-python@v6
188-
with:
189-
python-version: 3.9
190-
191181
- name: install_depends
192182
run: sh -x scripts/build/install_depends.sh
193183

@@ -200,10 +190,14 @@ jobs:
200190
if: ${{ !cancelled() && (success() || failure()) && needs.LoadJobs_conf.outputs.do_FuncTest == 'true' &&
201191
(needs.LoadJobs_conf.outputs.do_FullBuild != 'true' || needs.FullBuild.result == 'success') }}
202192
# The type of runner that the job will run on
203-
runs-on: ubuntu-${{ matrix.os }}
193+
runs-on: ubuntu-latest
194+
container:
195+
image: ubuntu:${{ matrix.os }}
196+
options: >-
197+
-v sources:/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
204198
env:
205199
COMPILER: ${{ matrix.compiler }}
206-
TAR_CMD: tar_nosuid
200+
TAR_CMD: tar
207201
GHA_OS: ubuntu-${{ matrix.os }}
208202

209203
strategy:
@@ -234,15 +228,15 @@ jobs:
234228
compiler: 'clang'
235229

236230
steps:
231+
- name: Install git
232+
run: |
233+
apt-get update
234+
apt-get install -y git lsb-release gnupg2 wget
235+
237236
- uses: actions/checkout@v6
238237
with:
239238
submodules: 'recursive'
240239

241-
- name: Workaround for tar not being able to access /var/cache/apt/archives
242-
run: |
243-
sudo cp "$(command -v tar)" "$(command -v tar)"_nosuid
244-
sudo chmod u+s "$(command -v tar)"
245-
246240
- name: Cache apt-get packages
247241
uses: actions/cache@v5
248242
with:
@@ -255,11 +249,6 @@ jobs:
255249
- name: Install apt-get updates
256250
run: scripts/ft-apt-get-update.sh
257251

258-
- name: Set up Python
259-
uses: actions/setup-python@v6
260-
with:
261-
python-version: 3.9
262-
263252
- name: install_depends
264253
run: sh -x scripts/build/install_depends.sh
265254

@@ -278,10 +267,14 @@ jobs:
278267
if: ${{ !cancelled() && (success() || failure()) && needs.LoadJobs_conf.outputs.do_Glitch == 'true' &&
279268
(needs.LoadJobs_conf.outputs.do_FuncTest != 'true' || needs.FuncTest.result == 'success') }}
280269
# The type of runner that the job will run on
281-
runs-on: ubuntu-${{ matrix.os }}
270+
runs-on: ubuntu-latest
271+
container:
272+
image: ubuntu:${{ matrix.os }}
273+
options: >-
274+
-v sources:/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
282275
env:
283276
COMPILER: ${{ matrix.compiler }}
284-
TAR_CMD: tar_nosuid
277+
TAR_CMD: tar
285278
GHA_OS: ubuntu-${{ matrix.os }}
286279

287280
strategy:
@@ -312,15 +305,15 @@ jobs:
312305
compiler: 'clang'
313306

314307
steps:
308+
- name: Install git
309+
run: |
310+
apt-get update
311+
apt-get install -y git lsb-release gnupg2 wget
312+
315313
- uses: actions/checkout@v6
316314
with:
317315
submodules: 'recursive'
318316

319-
- name: Workaround for tar not being able to access /var/cache/apt/archives
320-
run: |
321-
sudo cp "$(command -v tar)" "$(command -v tar)"_nosuid
322-
sudo chmod u+s "$(command -v tar)"
323-
324317
- name: Cache apt-get packages
325318
uses: actions/cache@v5
326319
with:
@@ -333,11 +326,6 @@ jobs:
333326
- name: Install apt-get updates
334327
run: scripts/ft-apt-get-update.sh
335328

336-
- name: Set up Python
337-
uses: actions/setup-python@v6
338-
with:
339-
python-version: 3.9
340-
341329
- name: install_depends
342330
run: sh -x scripts/build/install_depends.sh
343331

scripts/build/build.conf.sub

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ then
3232
SUDO="sudo"
3333
fi
3434

35+
PKGS="${PKGS} wget make git pkg-config libtool automake autoconf python3 sudo netcat-openbsd"
36+
3537
case "${COMPILER}" in
3638
gcc)
3739
export CC="${COMPILER}"
@@ -44,7 +46,7 @@ gcc-i386-cross)
4446
DOCKR_PLATFORM="x86_64"
4547
export BUILD_OS="ubuntu-18.04"
4648
PRE_INSTALL_CMD="enable_arch i386"
47-
PKGS="${PKGS} wget make git libssl-dev:i386 pkg-config libtool automake autoconf python3 gcc g++ libc6-dev:i386 libstdc++6:i386 lib32gcc-7-dev"
49+
PKGS="${PKGS} libssl-dev:i386 gcc g++ libc6-dev:i386 libstdc++6:i386 lib32gcc-7-dev"
4850
;;
4951
gcc-mips64-cross)
5052
DOCKR_BASE="ubuntu:18.04"
@@ -54,7 +56,7 @@ gcc-mips64-cross)
5456
export AR="mips64-linux-gnuabi64-ar"
5557
export RANLIB="mips64-linux-gnuabi64-ranlib"
5658
POST_INSTALL_CMD="setup_qemu mips64 gnuabi64"
57-
PKGS="${PKGS} wget make git libssl-dev pkg-config libtool automake autoconf python3 gcc-mips64-linux-gnuabi64 libc-dev-mips64-cross qemu-user-static"
59+
PKGS="${PKGS} libssl-dev gcc-mips64-linux-gnuabi64 libc-dev-mips64-cross qemu-user-static"
5860
;;
5961
gcc-arm32-cross)
6062
export CC="arm-linux-gnueabihf-gcc"
@@ -64,7 +66,7 @@ gcc-arm32-cross)
6466
export BUILD_OS="ubuntu-18.04"
6567
DOCKR_BASE="ubuntu:18.04"
6668
DOCKR_PLATFORM="x86_64"
67-
PKGS="${PKGS} wget make git libssl-dev pkg-config libtool automake autoconf python3 gcc-arm-linux-gnueabihf libc-dev-armhf-cross qemu-user-static"
69+
PKGS="${PKGS} libssl-dev gcc-arm-linux-gnueabihf libc-dev-armhf-cross qemu-user-static"
6870
;;
6971
gcc-arm64-cross)
7072
export CC="aarch64-linux-gnu-gcc"
@@ -74,35 +76,35 @@ gcc-arm64-cross)
7476
export BUILD_OS="ubuntu-18.04"
7577
DOCKR_BASE="ubuntu:18.04"
7678
DOCKR_PLATFORM="x86_64"
77-
PKGS="${PKGS} wget make git libssl-dev pkg-config libtool automake autoconf python3 gcc-aarch64-linux-gnu libc-dev-arm64-cross qemu-user-static"
79+
PKGS="${PKGS} libssl-dev gcc-aarch64-linux-gnu libc-dev-arm64-cross qemu-user-static"
7880
;;
7981
gcc-arm32-qemu-cross)
8082
export CC="/usr/lib/ccache/gcc"
8183
export CCACHE_DIR="`pwd`/ccache"
8284
DOCKR_BASE="ubuntu"
8385
DOCKR_PLATFORM="arm/v7"
84-
PKGS="${PKGS} wget make git libssl-dev pkg-config libtool automake autoconf python3 gcc g++ ccache"
86+
PKGS="${PKGS} libssl-dev gcc g++ ccache"
8587
;;
8688
clang-arm32-qemu-cross)
8789
export CC="/usr/lib/ccache/clang"
8890
export CCACHE_DIR="`pwd`/ccache"
8991
DOCKR_BASE="ubuntu"
9092
DOCKR_PLATFORM="arm/v7"
91-
PKGS="${PKGS} wget make git libssl-dev pkg-config libtool automake autoconf python3 clang llvm-dev ccache"
93+
PKGS="${PKGS} libssl-dev clang llvm-dev ccache"
9294
;;
9395
gcc-arm64-qemu-cross)
9496
export CC="/usr/lib/ccache/gcc"
9597
export CCACHE_DIR="`pwd`/ccache"
9698
DOCKR_BASE="ubuntu"
9799
DOCKR_PLATFORM="arm64/v8"
98-
PKGS="${PKGS} wget make git libssl-dev pkg-config libtool automake autoconf python3 gcc g++ ccache"
100+
PKGS="${PKGS} libssl-dev gcc g++ ccache"
99101
;;
100102
clang-arm64-qemu-cross)
101103
export CC="/usr/lib/ccache/clang"
102104
export CCACHE_DIR="`pwd`/ccache"
103105
DOCKR_BASE="ubuntu"
104106
DOCKR_PLATFORM="arm64/v8"
105-
PKGS="${PKGS} wget make git libssl-dev pkg-config libtool automake autoconf python3 clang llvm-dev ccache"
107+
PKGS="${PKGS} libssl-dev clang llvm-dev ccache"
106108
;;
107109
clang)
108110
export CC="${COMPILER}"
@@ -118,7 +120,7 @@ clang-i386-cross)
118120
DOCKR_PLATFORM="x86_64"
119121
export BUILD_OS="ubuntu-18.04"
120122
PRE_INSTALL_CMD="enable_arch i386"
121-
PKGS="${PKGS} wget make git libssl-dev:i386 pkg-config libtool automake autoconf python3 clang llvm-dev libc6-dev:i386 libstdc++6:i386 lib32gcc-7-dev"
123+
PKGS="${PKGS} libssl-dev:i386 clang llvm-dev libc6-dev:i386 libstdc++6:i386 lib32gcc-7-dev"
122124
;;
123125
gcc-*)
124126
export CC="${COMPILER}"

scripts/build/start_container.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ then
1111
exit 1
1212
fi
1313

14-
sudo apt-get update
15-
sudo apt-get install -y qemu-user-static
14+
if ! docker -v 2>/dev/null
15+
then
16+
${SUDO} apt-get update
17+
${SUDO} apt-get install -y docker.io
18+
fi
19+
docker run --rm --privileged tonistiigi/binfmt:latest -install all
1620
docker pull ${DOCKR_BASE}
17-
docker run --cidfile "${DKR_CID_FILE}" -d --restart=always --platform linux/${DOCKR_PLATFORM} -v `pwd`:`pwd` ${DOCKR_BASE} sleep infinity
21+
docker run --cidfile "${DKR_CID_FILE}" -d --restart=always \
22+
--platform linux/${DOCKR_PLATFORM} -v sources:`pwd` ${DOCKR_BASE} sleep infinity

scripts/do-build.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ automake --version
2121
autoconf --version
2222
autoreconf --version
2323

24-
if [ "${TTYPE}" != "depsbuild" -a "${TTYPE}" != "cleanbuild" ]
25-
then
26-
${SUDO} iptables -w -L OUTPUT
27-
${SUDO} iptables -w -L INPUT
28-
${SUDO} sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
29-
fi
3024
echo -n "/proc/sys/kernel/core_pattern: "
3125
cat /proc/sys/kernel/core_pattern
3226
${SUDO} sysctl -w kernel.core_pattern=core
@@ -40,6 +34,10 @@ fi
4034

4135
if [ "${TTYPE}" = "cleanbuild" ]
4236
then
37+
if [ -n "${DOCKR_PLATFORM}" ]
38+
then
39+
CONFIGURE_ARGS="${CONFIGURE_ARGS} --host=${DOCKR_PLATFORM}-pc-linux-gnu"
40+
fi
4341
./configure ${CONFIGURE_ARGS}
4442
exec make ${ALLCLEAN_TGT}
4543
fi
@@ -72,9 +70,13 @@ make
7270
${SUDO} make install
7371
cd ..
7472
wget https://ftp2.osuosl.org/pub/blfs/conglomeration/libsndfile/libsndfile-${SNDFILE_VER}.tar.xz
73+
if ! which xzcat
74+
then
75+
apt install -y xz-utils
76+
fi
7577
xzcat libsndfile-${SNDFILE_VER}.tar.xz | ${TAR_CMD} -xv -f -
7678
cd libsndfile-${SNDFILE_VER}
77-
./configure
79+
CFLAGS="-std=gnu17" ./configure
7880
make
7981
${SUDO} make install
8082
cd ${OPWD}
@@ -126,7 +128,7 @@ UDPR_DIR=/tmp/dist/udpreplay
126128

127129
git clone -b master https://github.com/sippy/udpreplay.git ${UDPR_DIR}
128130
mkdir ${UDPR_DIR}/build
129-
cmake -B${UDPR_DIR}/build -H${UDPR_DIR}
131+
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -B${UDPR_DIR}/build -H${UDPR_DIR}
130132
make -C ${UDPR_DIR}/build all
131133
${SUDO} make -C ${UDPR_DIR}/build install
132134

scripts/ft-before_install.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ set -e
66
. $(dirname $0)/build/build.conf.sub
77

88
${SUDO} apt-get -y install python3-pip python3-dev
9-
PIP_RUN="python -m pip"
9+
PIP_RUN="python3 -m pip"
10+
${SUDO} find /usr/lib -type f -name 'EXTERNALLY-MANAGED' -delete
1011
${PIP_RUN} install --user -U pip setuptools
11-
which python
12-
python --version
12+
which python3
13+
python3 --version
1314
for pkg in parsimonious cpp-coveralls
1415
do
1516
${PIP_RUN} install --user ${pkg}

tests/functions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ rtpproxy_start() {
216216
RTPP_RUNDIR=`pwd`
217217
if [ ! -z "${RTPP_OUTFILE}" ]
218218
then
219-
${RTPPROXY} --no_redirect -D -F -s ${TMP_SOCKFILE} -p ${TMP_PIDFILE} -d dbug "${@}" \
219+
sudo -n -u nobody ${RTPPROXY} --no_redirect -D -F -s ${TMP_SOCKFILE} -p ${TMP_PIDFILE} -d dbug "${@}" \
220220
>${RTPP_OUTFILE} 2>${TMP_LOGFILE}
221221
else
222-
${RTPPROXY} --no_redirect -D -F -s ${TMP_SOCKFILE} -p ${TMP_PIDFILE} -d dbug "${@}" \
222+
sudo -n -u nobody ${RTPPROXY} --no_redirect -D -F -s ${TMP_SOCKFILE} -p ${TMP_PIDFILE} -d dbug "${@}" \
223223
2>${TMP_LOGFILE}
224224
fi
225225
RC=${?}

0 commit comments

Comments
 (0)