Skip to content

Commit

Permalink
Merge pull request #4175 from thaJeztah/23.0_backport_ci_split_build
Browse files Browse the repository at this point in the history
[23.0 backport] ci: enhanced build workflow
  • Loading branch information
thaJeztah authored Apr 11, 2023
2 parents d45284a + 3d0d576 commit 9d4a21c
Showing 1 changed file with 59 additions and 12 deletions.
71 changes: 59 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,35 @@ on:
pull_request:

jobs:
prepare:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.platforms.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Create matrix
id: platforms
run: |
echo "matrix=$(docker buildx bake cross --print | jq -cr '.target."cross".platforms')" >>${GITHUB_OUTPUT}
-
name: Show matrix
run: |
echo ${{ steps.platforms.outputs.matrix }}
build:
runs-on: ubuntu-20.04
needs:
- prepare
strategy:
fail-fast: false
matrix:
target:
- cross
- dynbinary-cross
- binary
- dynbinary
platform: ${{ fromJson(needs.prepare.outputs.matrix) }}
use_glibc:
- ""
- glibc
Expand All @@ -36,22 +57,22 @@ jobs:
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Run ${{ matrix.target }}
name: Build
uses: docker/bake-action@v2
with:
targets: ${{ matrix.target }}
set: |
*.platform=${{ matrix.platform }}
env:
USE_GLIBC: ${{ matrix.use_glibc }}
-
name: Flatten artifacts
name: Create tarball
working-directory: ./build
run: |
for dir in */; do
base=$(basename "$dir")
echo "Creating ${base}.tar.gz ..."
tar -cvzf "${base}.tar.gz" "$dir"
rm -rf "$dir"
done
mkdir /tmp/out
platform=${{ matrix.platform }}
platformPair=${platform//\//-}
tar -cvzf "/tmp/out/docker-${platformPair}.tar.gz" .
if [ -z "${{ matrix.use_glibc }}" ]; then
echo "ARTIFACT_NAME=${{ matrix.target }}" >> $GITHUB_ENV
else
Expand All @@ -62,11 +83,35 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./build/*
path: /tmp/out/*
if-no-files-found: error

prepare-plugins:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.platforms.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Create matrix
id: platforms
run: |
echo "matrix=$(docker buildx bake plugins-cross --print | jq -cr '.target."plugins-cross".platforms')" >>${GITHUB_OUTPUT}
-
name: Show matrix
run: |
echo ${{ steps.platforms.outputs.matrix }}
plugins:
runs-on: ubuntu-20.04
needs:
- prepare-plugins
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.prepare-plugins.outputs.matrix) }}
steps:
-
name: Checkout
Expand All @@ -75,7 +120,9 @@ jobs:
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build plugins
name: Build
uses: docker/bake-action@v2
with:
targets: plugins-cross
set: |
*.platform=${{ matrix.platform }}

0 comments on commit 9d4a21c

Please sign in to comment.