Skip to content

Commit 1f3f64c

Browse files
authored
GH Actions cleanups and improvements (#3637)
* CI: multiple improvements and cleanups - Move jobs into a separate vanilla ubuntu container, not one provided by the github. - Re-add Ubuntu 20.04, add 24.04 into more places. - GC enable_ubuntu_toolchain_test. - set CPP_CMD for gcc. - Unify DOCKR_BASE and BUILD_OS. * CI: move notifications into a separate file and unify.
1 parent af3e1ea commit 1f3f64c

14 files changed

Lines changed: 141 additions & 85 deletions

.github/workflows/.notify.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: notify
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
job_name:
7+
required: true
8+
type: string
9+
job_result:
10+
required: true
11+
type: string
12+
13+
jobs:
14+
notify_slack:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Notify slack fail
18+
if: ${{ inputs.job_result == 'failure' && github.repository == 'OpenSIPS/opensips' }}
19+
env:
20+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
21+
uses: voxmedia/github-action-slack-notify-build@v1
22+
with:
23+
channel: devel
24+
status: FAILED
25+
color: danger
26+
27+
- name: Post Fail
28+
if: ${{ inputs.job_result == 'failure' }}
29+
run: |
30+
echo "💥 \"${{ inputs.job_name }}\" failed – marking workflow 💩" >&2
31+
exit 1

.github/workflows/.rtp.io.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Set dynamic environment
4242
id: set-env
4343
run: |
44-
BUILD_OS="`echo ${{ inputs.rtpp-tag }} | sed 's|-.*|| ; s|_|-|g'`"
44+
BUILD_OS="`echo ${{ inputs.rtpp-tag }} | sed 's|-.*|| ; s|_|:|g'`"
4545
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
4646
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
4747
sort -u | grep -v unknown | BUILD_OS="${BUILD_OS}" ./scripts/build/get-arch-buildargs.rtp.io fltplatforms | paste -sd ','`"
@@ -169,7 +169,8 @@ jobs:
169169
id: set-env
170170
run: |
171171
OUTPUT_TAG="myimage:`echo ${{ matrix.platform }} | sed 's|/|-|g'`"
172-
OUTPUT_IMAGE_N="image-${BUILD_OS}-`echo ${{ matrix.platform }} | sed 's|/|-|g'`"
172+
_BUILD_OS="`echo ${BUILD_OS} | sed 's|:|-|g'`"
173+
OUTPUT_IMAGE_N="image-${_BUILD_OS}-`echo ${{ matrix.platform }} | sed 's|/|-|g'`"
173174
OUTPUT_IMAGE="./${OUTPUT_IMAGE_N}.tar"
174175
CACHE_SPEC="type=gha,scope=${OUTPUT_IMAGE_N}-buildcache"
175176
echo OUTPUT_TAG="${OUTPUT_TAG}" >> $GITHUB_ENV
@@ -255,7 +256,8 @@ jobs:
255256
id: set-env
256257
run: |
257258
OUTPUT_TAG="myimage:`echo ${{ matrix.platform }} | sed 's|/|-|g'`"
258-
OUTPUT_IMAGE_N="image-${BUILD_OS}-`echo ${{ matrix.platform }} | sed 's|/|-|g'`"
259+
_BUILD_OS="`echo ${BUILD_OS} | sed 's|:|-|g'`"
260+
OUTPUT_IMAGE_N="image-${_BUILD_OS}-`echo ${{ matrix.platform }} | sed 's|/|-|g'`"
259261
OUTPUT_IMAGE="./${OUTPUT_IMAGE_N}.tar"
260262
echo OUTPUT_TAG="${OUTPUT_TAG}" >> $GITHUB_ENV
261263
echo OUTPUT_IMAGE="${OUTPUT_IMAGE}" >> $GITHUB_ENV

.github/workflows/cifuzz.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ jobs:
2323
with:
2424
name: artifacts
2525
path: ./out/artifacts
26+
27+
all_done:
28+
needs: Fuzzing
29+
uses: ./.github/workflows/.notify.yml
30+
with:
31+
job_name: "CIFuzz"
32+
job_result: ${{ needs.Fuzzing.result }}
33+
if: ${{ always() }}

.github/workflows/main.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,26 @@ jobs:
1717
build:
1818
# The type of runner that the job will run on
1919
runs-on: ubuntu-latest
20-
continue-on-error: true
2120
container:
2221
image: ubuntu:${{ matrix.os }}
2322
env:
2423
COMPILER: ${{ matrix.compiler }}
25-
BUILD_OS: ubuntu-${{ matrix.os }}
24+
BUILD_OS: ubuntu:${{ matrix.os }}
2625

2726
strategy:
2827
fail-fast: false
2928
matrix:
30-
os: [22.04, 24.04]
29+
os: [20.04, 22.04, 24.04]
3130
compiler: ['gcc', 'clang']
3231
include:
32+
- os: 20.04
33+
compiler: 'gcc-9'
34+
- os: 20.04
35+
compiler: 'gcc-10'
36+
- os: 20.04
37+
compiler: 'clang-9'
38+
- os: 20.04
39+
compiler: 'clang-10'
3340
- os: 22.04
3441
compiler: 'gcc-11'
3542
- os: 22.04
@@ -53,7 +60,6 @@ jobs:
5360

5461
# Steps represent a sequence of tasks that will be executed as part of the job
5562
steps:
56-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
5763
- name: Install git
5864
run: |
5965
apt-get update
@@ -72,16 +78,10 @@ jobs:
7278
- name: Build
7379
run: sh -x scripts/build/do_build.sh
7480

75-
notify:
76-
runs-on: ubuntu-latest
81+
all_done:
7782
needs: build
78-
steps:
79-
- name: Notify slack fail
80-
if: failure() && github.repository == 'OpenSIPS/opensips'
81-
env:
82-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
83-
uses: voxmedia/github-action-slack-notify-build@v1
84-
with:
85-
channel: devel
86-
status: FAILED
87-
color: danger
83+
uses: ./.github/workflows/.notify.yml
84+
with:
85+
job_name: "Main CI"
86+
job_result: ${{ needs.build.result }}
87+
if: ${{ always() }}

.github/workflows/multiarch.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,27 @@ jobs:
1616
# This workflow contains a single job called "build"
1717
build_multiarch:
1818
# The type of runner that the job will run on
19-
runs-on: ${{ matrix.os }}
20-
continue-on-error: true
19+
runs-on: ubuntu-latest
20+
container:
21+
image: ubuntu:${{ matrix.os }}
22+
options: >-
23+
-v sources:/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
2124
env:
2225
COMPILER: ${{ matrix.compiler }}
23-
BUILD_OS: ${{ matrix.os }}
24-
26+
BUILD_OS: ubuntu:${{ matrix.os }}
2527
strategy:
2628
fail-fast: false
2729
matrix:
2830
compiler: ['gcc-i386-cross', 'clang-i386-cross', 'gcc-mips64-cross', 'gcc-arm32-cross', 'gcc-arm64-cross', 'gcc-arm32-qemu-cross', 'gcc-arm64-qemu-cross', 'clang-arm32-qemu-cross', 'clang-arm64-qemu-cross']
29-
os: [ubuntu-22.04]
31+
os: [22.04]
3032

3133
# Steps represent a sequence of tasks that will be executed as part of the job
3234
steps:
35+
- name: Install git
36+
run: |
37+
apt-get update
38+
apt-get install -y git lsb-release gnupg2 wget
39+
3340
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3441
- uses: actions/checkout@v4
3542
with:
@@ -63,16 +70,10 @@ jobs:
6370
if: endsWith(matrix.compiler, '-qemu-cross')
6471
run: scripts/build/print_ccache_stats.sh
6572

66-
notify:
67-
runs-on: ubuntu-latest
73+
all_done:
6874
needs: build_multiarch
69-
steps:
70-
- name: Notify slack fail
71-
if: failure() && github.repository == 'OpenSIPS/opensips'
72-
env:
73-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
74-
uses: voxmedia/github-action-slack-notify-build@v1
75-
with:
76-
channel: devel
77-
status: FAILED
78-
color: danger
75+
uses: ./.github/workflows/.notify.yml
76+
with:
77+
job_name: "Multi-Architecture Build"
78+
job_result: ${{ needs.build_multiarch.result }}
79+
if: ${{ always() }}

.github/workflows/rtp.io.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,11 @@ jobs:
130130
fail-fast: false
131131
matrix:
132132
rtpp-tag: [debian_12-slim, ubuntu_latest]
133+
134+
all_done:
135+
needs: build_test_rtp_io_dock
136+
uses: ./.github/workflows/.notify.yml
137+
with:
138+
job_name: "rtp.io"
139+
job_result: ${{ needs.build_test_rtp_io_dock.result }}
140+
if: ${{ always() }}

.github/workflows/unittests.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,33 @@ jobs:
1616
# This workflow contains a single job called "build"
1717
build_and_test:
1818
# The type of runner that the job will run on
19-
runs-on: ubuntu-${{ matrix.os }}
20-
continue-on-error: true
19+
runs-on: ubuntu-latest
20+
container:
21+
image: ubuntu:${{ matrix.os }}
22+
options: >-
23+
-v sources:/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
2124
env:
2225
COMPILER: ${{ matrix.compiler }}
23-
BUILD_OS: ubuntu-${{ matrix.os }}
26+
BUILD_OS: ubuntu:${{ matrix.os }}
2427

2528
strategy:
2629
fail-fast: false
2730
matrix:
2831
os: [22.04]
2932
compiler: ['gcc', 'clang', 'gcc-11', 'gcc-12', 'clang-11', 'clang-12', 'clang-13', 'clang-14', 'clang-15', 'gcc-arm64-qemu-cross', 'gcc-arm32-qemu-cross', 'clang-arm64-qemu-cross', 'clang-arm32-qemu-cross']
3033
include:
34+
- os: 20.04
35+
compiler: 'gcc'
36+
- os: 20.04
37+
compiler: 'clang'
38+
- os: 20.04
39+
compiler: 'gcc-9'
40+
- os: 20.04
41+
compiler: 'gcc-10'
42+
- os: 20.04
43+
compiler: 'clang-9'
44+
- os: 20.04
45+
compiler: 'clang-10'
3146
- os: 24.04
3247
compiler: 'gcc'
3348
- os: 24.04
@@ -47,6 +62,11 @@ jobs:
4762

4863
# Steps represent a sequence of tasks that will be executed as part of the job
4964
steps:
65+
- name: Install git
66+
run: |
67+
apt-get update
68+
apt-get install -y git lsb-release gnupg2 wget
69+
5070
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
5171
- uses: actions/checkout@v4
5272
with:
@@ -99,17 +119,10 @@ jobs:
99119
path: |
100120
unit_tests.log
101121
102-
notify:
103-
runs-on: ubuntu-latest
122+
all_done:
104123
needs: build_and_test
105-
steps:
106-
- name: Notify slack fail
107-
if: failure() && github.repository == 'OpenSIPS/opensips'
108-
env:
109-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
110-
uses: voxmedia/github-action-slack-notify-build@v1
111-
with:
112-
channel: devel
113-
status: FAILED
114-
color: danger
115-
124+
uses: ./.github/workflows/.notify.yml
125+
with:
126+
job_name: "Unit Tests"
127+
job_result: ${{ needs.build_and_test.result }}
128+
if: ${{ always() }}

docker/Dockerfile.rtp.io

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ WORKDIR /src
1414
ARG LLVM_VER=18
1515
ARG LLVM_VER_OLD=16
1616
ARG TARGETPLATFORM
17-
ARG BUILD_OS=ubuntu-latest
17+
ARG BUILD_OS=ubuntu:latest
1818
RUN --mount=type=bind,source=scripts/build,target=scripts/build \
1919
--mount=type=cache,target=/var/cache/apt,sharing=locked \
2020
env `./scripts/build/get-arch-buildargs.rtp.io platformopts` \

scripts/build/build.conf.sub

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
enable_ubuntu_toolchain_test() {
2-
${SUDO} env DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common
3-
${SUDO} add-apt-repository -y ppa:ubuntu-toolchain-r/test
4-
}
5-
61
setup_qemu() {
72
ARCH1="${1}"
83
ARCH2="${2}"
@@ -41,17 +36,15 @@ gcc-i386-cross)
4136
export CC="gcc"
4237
CC_EXTRA_OPTS="-Werror -m32"
4338
MAKE_TGT="opensips"
44-
DOCKR_BASE="ubuntu:18.04"
4539
DOCKR_PLATFORM="x86_64"
46-
export BUILD_OS="ubuntu-18.04"
40+
export BUILD_OS="ubuntu:18.04"
4741
PRE_INSTALL_CMD="${SUDO} dpkg --add-architecture i386"
4842
PKGS="`exclude_pkgs 2.3.7` gcc g++ libc6-dev:i386 libstdc++6:i386 lib32gcc-7-dev"
4943
;;
5044
gcc-mips64-cross)
5145
MAKE_TGT="opensips"
52-
DOCKR_BASE="ubuntu:18.04"
5346
DOCKR_PLATFORM="x86_64"
54-
export BUILD_OS="ubuntu-18.04"
47+
export BUILD_OS="ubuntu:18.04"
5548
export CC="mips64-linux-gnuabi64-gcc"
5649
export AR="mips64-linux-gnuabi64-ar"
5750
export RANLIB="mips64-linux-gnuabi64-ranlib"
@@ -64,8 +57,7 @@ gcc-arm32-cross)
6457
export AR="arm-linux-gnueabihf-ar"
6558
export RANLIB="arm-linux-gnueabihf-ranlib"
6659
POST_INSTALL_CMD="setup_qemu arm gnueabihf"
67-
export BUILD_OS="ubuntu-18.04"
68-
DOCKR_BASE="ubuntu:18.04"
60+
export BUILD_OS="ubuntu:18.04"
6961
DOCKR_PLATFORM="x86_64"
7062
PKGS="`exclude_pkgs 2.3.7` gcc-arm-linux-gnueabihf libc-dev-armhf-cross qemu-user-static"
7163
;;
@@ -75,39 +67,34 @@ gcc-arm64-cross)
7567
export AR="aarch64-linux-gnu-ar"
7668
export RANLIB="aarch64-linux-gnu-ranlib"
7769
POST_INSTALL_CMD="setup_qemu aarch64 gnu"
78-
export BUILD_OS="ubuntu-18.04"
79-
DOCKR_BASE="ubuntu:18.04"
70+
export BUILD_OS="ubuntu:18.04"
8071
DOCKR_PLATFORM="x86_64"
8172
PKGS="`exclude_pkgs 2.3.7` gcc-aarch64-linux-gnu libc-dev-arm64-cross qemu-user-static"
8273
;;
8374
gcc-arm32-qemu-cross)
8475
export CC="/usr/lib/ccache/gcc"
8576
export CCACHE_DIR="`pwd`/ccache"
86-
DOCKR_BASE="ubuntu"
8777
DOCKR_PLATFORM="arm/v7"
8878
PKGS="`exclude_pkgs 2.3.7` gcc g++ ccache"
8979
EXCLUDE_MODULES_ADD="db_unixodbc"
9080
;;
9181
clang-arm32-qemu-cross)
9282
export CC="/usr/lib/ccache/clang"
9383
export CCACHE_DIR="`pwd`/ccache"
94-
DOCKR_BASE="ubuntu"
9584
DOCKR_PLATFORM="arm/v7"
9685
PKGS="`exclude_pkgs 2.3.7` clang llvm-dev ccache"
9786
EXCLUDE_MODULES_ADD="db_unixodbc"
9887
;;
9988
gcc-arm64-qemu-cross)
10089
export CC="/usr/lib/ccache/gcc"
10190
export CCACHE_DIR="`pwd`/ccache"
102-
DOCKR_BASE="ubuntu"
10391
DOCKR_PLATFORM="arm64/v8"
10492
PKGS="`exclude_pkgs 2.3.7` gcc g++ ccache"
10593
EXCLUDE_MODULES_ADD="db_unixodbc"
10694
;;
10795
clang-arm64-qemu-cross)
10896
export CC="/usr/lib/ccache/clang"
10997
export CCACHE_DIR="`pwd`/ccache"
110-
DOCKR_BASE="ubuntu"
11198
DOCKR_PLATFORM="arm64/v8"
11299
PKGS="`exclude_pkgs 2.3.7` clang llvm-dev ccache"
113100
EXCLUDE_MODULES_ADD="db_unixodbc"
@@ -123,18 +110,17 @@ clang-i386-cross)
123110
export CC="clang"
124111
CC_EXTRA_OPTS="-Werror -m32"
125112
MAKE_TGT="opensips"
126-
DOCKR_BASE="ubuntu:18.04"
127113
DOCKR_PLATFORM="x86_64"
128-
export BUILD_OS="ubuntu-18.04"
114+
export BUILD_OS="ubuntu:18.04"
129115
PRE_INSTALL_CMD="${SUDO} dpkg --add-architecture i386"
130116
PKGS="`exclude_pkgs 2.3.7` clang llvm-dev libc6-dev:i386 libstdc++6:i386 lib32gcc-7-dev"
131117
;;
132118
gcc-*)
133119
export CC="${COMPILER}"
134120
export AR="gcc-ar-${COMPILER_VER}"
135121
export RANLIB="gcc-ranlib-${COMPILER_VER}"
122+
export CPP_CMD="cpp-${COMPILER_VER}"
136123
export GCOV_CMD="gcov-${COMPILER_VER}"
137-
PRE_INSTALL_CMD="enable_ubuntu_toolchain_test"
138124
PKGS="${PKGS} gcc-${COMPILER_VER} g++-${COMPILER_VER}"
139125
;;
140126
clang-*)

scripts/build/build_test_harness.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ make Makefile.conf
99
sed -i.bak '/-DCC_O0/d' Makefile.conf
1010
echo 'DEFS+= -I$(shell pwd)/'"${1}" >> Makefile.conf
1111
echo 'LIBS+= -L$(TOP_SRCDIR)/'"${1}" >> Makefile.conf
12-
if [ "${BUILD_OS}" = "ubuntu-22.04" ]
12+
if [ "${BUILD_OS}" = "ubuntu:22.04" ]
1313
then
1414
case "${COMPILER}" in
1515
*-qemu-cross)

0 commit comments

Comments
 (0)