Skip to content

Commit 0464fea

Browse files
committed
1 parent 0f85429 commit 0464fea

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

.github/workflows/.rtp.io.yml

+27-10
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,36 @@ on:
2424

2525
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2626
jobs:
27+
set_env:
28+
name: Set Environment
29+
runs-on: ubuntu-latest
30+
env:
31+
BASE_IMAGE: ${{ inputs.rtpp-repo }}-${{ inputs.rtpp-tag }}
32+
outputs:
33+
build-matrix: ${{ steps.set-env.outputs.build-matrix }}
34+
build-os: ${{ steps.set-env.outputs.build-os }}
35+
steps:
36+
- name: Set dynamic environment
37+
id: set-env
38+
run: |
39+
BUILD_OS="`echo ${{ inputs.rtpp-tag }} | sed 's|-.*|| ; s|_|-|g'`"
40+
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
41+
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
42+
sort -u | grep -v unknown | BUILD_OS="${BUILD_OS}" ./scripts/build/get-arch-buildargs.rtp.io fltplatforms | paste -sd ','`"
43+
echo "Platforms: ${PLATFORMS}"
44+
BUILD_MATRIX="`echo ${PLATFORMS} | tr ',' '\n' | jq -R . | jq -s . | tr '\n' ' '`"
45+
echo "build-os=${BUILD_OS}" >> $GITHUB_OUTPUT
46+
echo "build-matrix=${BUILD_MATRIX}" >> $GITHUB_OUTPUT
47+
2748
build_rtp_io_dock:
2849
name: Build OpenSIPS+rtp.io Container
50+
needs: set_env
2951
runs-on: ubuntu-latest
3052
permissions:
3153
packages: write
3254
env:
3355
BASE_IMAGE: ${{ inputs.rtpp-repo }}-${{ inputs.rtpp-tag }}
56+
BUILD_OS: ${{ needs.set_env.outputs.build-os }}
3457
outputs:
3558
test_matrix: ${{ steps.set-env.outputs.test_matrix }}
3659
build_image: ${{ steps.set-env.outputs.build_image }}
@@ -69,11 +92,9 @@ jobs:
6992
- name: Set dynamic environment
7093
id: set-env
7194
run: |
72-
BUILD_OS="`echo ${{ inputs.rtpp-tag }} | sed 's|-.*|| ; s|_|-|g'`"
73-
echo "BUILD_OS=${BUILD_OS}" >> $GITHUB_ENV
7495
PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \
7596
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
76-
sort -u | grep -v unknown | BUILD_OS="${BUILD_OS}" ./scripts/build/get-arch-buildargs.rtp.io fltplatforms | paste -sd ','`"
97+
sort -u | grep -v unknown | ./scripts/build/get-arch-buildargs.rtp.io fltplatforms | paste -sd ','`"
7798
echo "Platforms: ${PLATFORMS}"
7899
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
79100
GIT_BRANCH="${GIT_BRANCH#refs/tags/}"
@@ -83,7 +104,7 @@ jobs:
83104
echo "BUILD_IMAGE=${BUILD_IMAGE}" >> $GITHUB_ENV
84105
for _p in `echo ${PLATFORMS} | tr ',' '\n'`; \
85106
do \
86-
if TARGETPLATFORM="${_p}" BUILD_OS="${BUILD_OS}" ./scripts/build/get-arch-buildargs.rtp.io isbrokenplatform; \
107+
if TARGETPLATFORM="${_p}" ./scripts/build/get-arch-buildargs.rtp.io isbrokenplatform; \
87108
then \
88109
TEST_MATRIX="${_p}${TEST_MATRIX:+,}${TEST_MATRIX}"; \
89110
fi; \
@@ -112,7 +133,7 @@ jobs:
112133

113134
test_rtp_io_dock:
114135
name: Test OpenSIPS+rtp.io
115-
needs: build_rtp_io_dock
136+
needs: [build_rtp_io_dock, set_env]
116137
runs-on: ubuntu-latest
117138
strategy:
118139
fail-fast: false
@@ -121,13 +142,9 @@ jobs:
121142
env:
122143
TARGETPLATFORM: ${{ matrix.test_platform }}
123144
BUILD_IMAGE: ${{ needs.build_rtp_io_dock.outputs.build_image }}
145+
BUILD_OS: ${{ needs.set_env.outputs.build-os }}
124146

125147
steps:
126-
- name: Set dynamic environment
127-
run: |
128-
BUILD_OS="`echo ${{ inputs.rtpp-tag }} | sed 's|-.*|| ; s|_|-|g'`"
129-
echo "BUILD_OS=${BUILD_OS}" >> $GITHUB_ENV
130-
131148
- name: Set up QEMU
132149
id: qemu
133150
uses: docker/setup-qemu-action@v3

0 commit comments

Comments
 (0)