mirror of https://github.com/docker/cli.git
Merge pull request #4175 from thaJeztah/23.0_backport_ci_split_build
[23.0 backport] ci: enhanced build workflow
This commit is contained in:
commit
9d4a21cd79
|
@ -15,14 +15,35 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
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:
|
build:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
target:
|
target:
|
||||||
- cross
|
- binary
|
||||||
- dynbinary-cross
|
- dynbinary
|
||||||
|
platform: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
||||||
use_glibc:
|
use_glibc:
|
||||||
- ""
|
- ""
|
||||||
- glibc
|
- glibc
|
||||||
|
@ -36,22 +57,22 @@ jobs:
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
-
|
-
|
||||||
name: Run ${{ matrix.target }}
|
name: Build
|
||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v2
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
set: |
|
||||||
|
*.platform=${{ matrix.platform }}
|
||||||
env:
|
env:
|
||||||
USE_GLIBC: ${{ matrix.use_glibc }}
|
USE_GLIBC: ${{ matrix.use_glibc }}
|
||||||
-
|
-
|
||||||
name: Flatten artifacts
|
name: Create tarball
|
||||||
working-directory: ./build
|
working-directory: ./build
|
||||||
run: |
|
run: |
|
||||||
for dir in */; do
|
mkdir /tmp/out
|
||||||
base=$(basename "$dir")
|
platform=${{ matrix.platform }}
|
||||||
echo "Creating ${base}.tar.gz ..."
|
platformPair=${platform//\//-}
|
||||||
tar -cvzf "${base}.tar.gz" "$dir"
|
tar -cvzf "/tmp/out/docker-${platformPair}.tar.gz" .
|
||||||
rm -rf "$dir"
|
|
||||||
done
|
|
||||||
if [ -z "${{ matrix.use_glibc }}" ]; then
|
if [ -z "${{ matrix.use_glibc }}" ]; then
|
||||||
echo "ARTIFACT_NAME=${{ matrix.target }}" >> $GITHUB_ENV
|
echo "ARTIFACT_NAME=${{ matrix.target }}" >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
|
@ -62,11 +83,35 @@ jobs:
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ env.ARTIFACT_NAME }}
|
name: ${{ env.ARTIFACT_NAME }}
|
||||||
path: ./build/*
|
path: /tmp/out/*
|
||||||
if-no-files-found: error
|
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:
|
plugins:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
needs:
|
||||||
|
- prepare-plugins
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: ${{ fromJson(needs.prepare-plugins.outputs.matrix) }}
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
|
@ -75,7 +120,9 @@ jobs:
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
-
|
-
|
||||||
name: Build plugins
|
name: Build
|
||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v2
|
||||||
with:
|
with:
|
||||||
targets: plugins-cross
|
targets: plugins-cross
|
||||||
|
set: |
|
||||||
|
*.platform=${{ matrix.platform }}
|
||||||
|
|
Loading…
Reference in New Issue