Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Oct 21, 2024
1 parent 0f85429 commit 0464fea
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions .github/workflows/.rtp.io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,36 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
set_env:
name: Set Environment
runs-on: ubuntu-latest
env:
BASE_IMAGE: ${{ inputs.rtpp-repo }}-${{ inputs.rtpp-tag }}
outputs:
build-matrix: ${{ steps.set-env.outputs.build-matrix }}
build-os: ${{ steps.set-env.outputs.build-os }}
steps:
- name: Set dynamic environment
id: set-env
run: |
BUILD_OS="`echo ${{ inputs.rtpp-tag }} | sed 's|-.*|| ; s|_|-|g'`"
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 | BUILD_OS="${BUILD_OS}" ./scripts/build/get-arch-buildargs.rtp.io fltplatforms | paste -sd ','`"
echo "Platforms: ${PLATFORMS}"
BUILD_MATRIX="`echo ${PLATFORMS} | tr ',' '\n' | jq -R . | jq -s . | tr '\n' ' '`"
echo "build-os=${BUILD_OS}" >> $GITHUB_OUTPUT
echo "build-matrix=${BUILD_MATRIX}" >> $GITHUB_OUTPUT
build_rtp_io_dock:
name: Build OpenSIPS+rtp.io Container
needs: set_env
runs-on: ubuntu-latest
permissions:
packages: write
env:
BASE_IMAGE: ${{ inputs.rtpp-repo }}-${{ inputs.rtpp-tag }}
BUILD_OS: ${{ needs.set_env.outputs.build-os }}
outputs:
test_matrix: ${{ steps.set-env.outputs.test_matrix }}
build_image: ${{ steps.set-env.outputs.build_image }}
Expand Down Expand Up @@ -69,11 +92,9 @@ jobs:
- name: Set dynamic environment
id: set-env
run: |
BUILD_OS="`echo ${{ inputs.rtpp-tag }} | sed 's|-.*|| ; s|_|-|g'`"
echo "BUILD_OS=${BUILD_OS}" >> $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)"' | \
sort -u | grep -v unknown | BUILD_OS="${BUILD_OS}" ./scripts/build/get-arch-buildargs.rtp.io fltplatforms | 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/}}"
GIT_BRANCH="${GIT_BRANCH#refs/tags/}"
Expand All @@ -83,7 +104,7 @@ jobs:
echo "BUILD_IMAGE=${BUILD_IMAGE}" >> $GITHUB_ENV
for _p in `echo ${PLATFORMS} | tr ',' '\n'`; \
do \
if TARGETPLATFORM="${_p}" BUILD_OS="${BUILD_OS}" ./scripts/build/get-arch-buildargs.rtp.io isbrokenplatform; \
if TARGETPLATFORM="${_p}" ./scripts/build/get-arch-buildargs.rtp.io isbrokenplatform; \
then \
TEST_MATRIX="${_p}${TEST_MATRIX:+,}${TEST_MATRIX}"; \
fi; \
Expand Down Expand Up @@ -112,7 +133,7 @@ jobs:

test_rtp_io_dock:
name: Test OpenSIPS+rtp.io
needs: build_rtp_io_dock
needs: [build_rtp_io_dock, set_env]
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -121,13 +142,9 @@ jobs:
env:
TARGETPLATFORM: ${{ matrix.test_platform }}
BUILD_IMAGE: ${{ needs.build_rtp_io_dock.outputs.build_image }}
BUILD_OS: ${{ needs.set_env.outputs.build-os }}

steps:
- name: Set dynamic environment
run: |
BUILD_OS="`echo ${{ inputs.rtpp-tag }} | sed 's|-.*|| ; s|_|-|g'`"
echo "BUILD_OS=${BUILD_OS}" >> $GITHUB_ENV
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
Expand Down

0 comments on commit 0464fea

Please sign in to comment.