Skip to content

Commit 9c0709e

Browse files
authored
Merge pull request #98 from emqx/ci-split-arm64-amd64
ci: split arm64 and amd64 build steps for faster compilation
2 parents d6df391 + fd28daf commit 9c0709e

File tree

18 files changed

+305
-125
lines changed

18 files changed

+305
-125
lines changed

.github/workflows/base.yaml

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,44 @@ on:
1111
jobs:
1212

1313
base:
14-
runs-on: ubuntu-latest
14+
runs-on: ${{ github.repository_owner == 'emqx' && matrix.platform[2] || '["ubuntu-latest"]' }}
1515
strategy:
1616
fail-fast: false
1717
matrix:
1818
base_image_vsn:
1919
- "5.0"
2020
platform:
21-
- [ubuntu22.04 , "linux/amd64,linux/arm64"]
22-
- [ubuntu20.04 , "linux/amd64,linux/arm64"]
23-
- [ubuntu18.04 , "linux/amd64,linux/arm64"]
24-
- [ubuntu16.04 , "linux/amd64,linux/arm64"]
25-
- [debian12 , "linux/amd64,linux/arm64"]
26-
- [debian11 , "linux/amd64,linux/arm64"]
27-
- [debian10 , "linux/amd64,linux/arm64"]
28-
- [debian9 , "linux/amd64,linux/arm64"]
29-
- [el9 , "linux/amd64,linux/arm64"]
30-
- [el8 , "linux/amd64,linux/arm64"]
31-
- [el7 , "linux/amd64,linux/arm64"]
32-
- [amzn2 , "linux/amd64,linux/arm64"]
33-
- [amzn2023 , "linux/amd64,linux/arm64"]
34-
- [alpine3.15.1, "linux/amd64,linux/arm64"]
21+
- [ubuntu22.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
22+
- [ubuntu22.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
23+
- [ubuntu20.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
24+
- [ubuntu20.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
25+
- [ubuntu18.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
26+
- [ubuntu18.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
27+
- [ubuntu16.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
28+
- [ubuntu16.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
29+
- [debian12, linux/amd64, [self-hosted, linux, x64, ephemeral]]
30+
- [debian12, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
31+
- [debian11, linux/amd64, [self-hosted, linux, x64, ephemeral]]
32+
- [debian11, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
33+
- [debian10, linux/amd64, [self-hosted, linux, x64, ephemeral]]
34+
- [debian10, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
35+
- [debian9, linux/amd64, [self-hosted, linux, x64, ephemeral]]
36+
- [debian9, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
37+
- [el9, linux/amd64, [self-hosted, linux, x64, ephemeral]]
38+
- [el9, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
39+
- [el8, linux/amd64, [self-hosted, linux, x64, ephemeral]]
40+
- [el8, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
41+
- [el7, linux/amd64, [self-hosted, linux, x64, ephemeral]]
42+
- [el7, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
43+
- [amzn2, linux/amd64, [self-hosted, linux, x64, ephemeral]]
44+
- [amzn2, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
45+
- [amzn2023, linux/amd64, [self-hosted, linux, x64, ephemeral]]
46+
- [amzn2023, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
47+
- [alpine3.15.1, linux/amd64, [self-hosted, linux, x64, ephemeral]]
48+
- [alpine3.15.1, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
49+
50+
env:
51+
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/base-${{ matrix.base_image_vsn }}
3552

3653
steps:
3754
- uses: actions/checkout@v3
@@ -40,23 +57,30 @@ jobs:
4057
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
4158
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
4259
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
60+
- name: define base tag
61+
id: base_tag
62+
run: |
63+
PLATFORM=${{ matrix.platform[1] }}
64+
ARCH=${PLATFORM#linux/}
65+
echo "tag=${{ matrix.platform[0] }}-${ARCH}" | tee -a $GITHUB_OUTPUT
4366
- name: Get cache
44-
run: aws s3 sync s3://docker-buildx-cache/emqx-builder/${{ matrix.platform[0] }} /tmp/.docker-buildx-cache
45-
- uses: docker/setup-buildx-action@v2
46-
- uses: docker/setup-qemu-action@v2
47-
- uses: docker/login-action@v2
67+
run: aws s3 sync s3://docker-buildx-cache/emqx-builder/${{ steps.base_tag.outputs.tag }} /tmp/.docker-buildx-cache
68+
- uses: docker/setup-buildx-action@v3
69+
- uses: docker/setup-qemu-action@v3
70+
- uses: docker/login-action@v3
4871
with:
4972
registry: ghcr.io
5073
username: ${{ github.actor }}
5174
password: ${{ github.token }}
52-
- uses: docker/metadata-action@v4
75+
- uses: docker/metadata-action@v5
5376
id: base_meta
5477
with:
55-
images: ghcr.io/${{ github.repository }}/base-${{ matrix.base_image_vsn }}
56-
tags: type=raw,value=${{ matrix.platform[0] }}
78+
images: ${{ env.REGISTRY_IMAGE }}
79+
tags: type=raw,value=${{ steps.base_tag.outputs.tag }}
5780
- name: Build base image
58-
uses: docker/build-push-action@v3
81+
uses: docker/build-push-action@v5
5982
with:
83+
push: true
6084
pull: true
6185
cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max
6286
cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max
@@ -66,4 +90,4 @@ jobs:
6690
file: ${{ matrix.platform[0] }}/Dockerfile
6791
context: .
6892
- name: Update cache
69-
run: aws s3 sync --delete /tmp/.docker-buildx-cache-new s3://docker-buildx-cache/emqx-builder/${{ matrix.platform[0] }}
93+
run: aws s3 sync --delete /tmp/.docker-buildx-cache-new s3://docker-buildx-cache/emqx-builder/${{ steps.base_tag.outputs.tag }}

0 commit comments

Comments
 (0)