Skip to content

Commit 9a2feca

Browse files
mp builds on different runners
1 parent 822d849 commit 9a2feca

1 file changed

Lines changed: 29 additions & 16 deletions

File tree

.github/workflows/build.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,29 @@ env:
1010
DOCKER_METADATA_SET_OUTPUT_ENV: 'true'
1111

1212
jobs:
13-
build:
13+
meta:
1414
runs-on: ubuntu-latest
1515
outputs:
16-
build-image: ${{ steps.build-meta.outputs.tags }}
16+
build-labels: ${{ steps.build-meta.outputs.labels }}
17+
build-tags: ${{ steps.build-meta.outputs.tags }}
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Produce the build image tag
23+
id: build-meta
24+
uses: docker/metadata-action@v5
25+
with:
26+
images: ghcr.io/${{ github.repository }}
27+
tags: type=sha,suffix=-build-${{ github.run_id }}_${{ github.run_attempt }}
28+
29+
build:
30+
needs:
31+
- meta
32+
strategy:
33+
matrix:
34+
runner: ['ubuntu-latest', 'macos-latest']
35+
runs-on: ${{ matrix.runner }}
1736
steps:
1837
- name: Checkout code
1938
uses: actions/checkout@v4
@@ -31,32 +50,25 @@ jobs:
3150
username: ${{ github.actor }}
3251
password: ${{ secrets.GITHUB_TOKEN }}
3352

34-
- name: Produce the build image tag
35-
id: build-meta
36-
uses: docker/metadata-action@v5
37-
with:
38-
images: ghcr.io/${{ github.repository }}
39-
tags: type=sha,suffix=-build-${{ github.run_id }}_${{ github.run_attempt }}
40-
4153
- name: Build and push the untested image
4254
uses: docker/build-push-action@v6
4355
with:
44-
cache-from: type=gha
45-
cache-to: type=gha,mode=max
46-
labels: ${{ steps.build-meta.outputs.labels }}
47-
platforms: linux/amd64,linux/arm64
56+
cache-from: type=registry,ref=${{ github.repository }}:cache-${{ matrix.runner }}
57+
cache-to: type=registry,ref=${{ github.repository }}:cache-${{ matrix.runner }},mode=max
58+
labels: ${{ needs.meta.outputs.build-labels }}
4859
provenance: true
4960
push: true
5061
sbom: true
51-
tags: ${{ steps.build-meta.outputs.tags }}
62+
tags: ${{ needs.meta.outputs.build-tags }}
5263

5364
test:
5465
runs-on: ubuntu-latest
5566
needs:
67+
- meta
5668
- build
5769
env:
5870
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
59-
DOCKER_APP_IMAGE: ${{ needs.build.outputs.build-image }}
71+
DOCKER_APP_IMAGE: ${{ needs.meta.outputs.build-tags }}
6072
steps:
6173
- name: Checkout code
6274
uses: actions/checkout@v4
@@ -80,10 +92,11 @@ jobs:
8092
push:
8193
runs-on: ubuntu-latest
8294
needs:
95+
- meta
8396
- build
8497
- test
8598
env:
86-
DOCKER_APP_IMAGE: ${{ needs.build.outputs.build-image }}
99+
DOCKER_APP_IMAGE: ${{ needs.meta.outputs.build-tags }}
87100
steps:
88101
- name: Checkout code
89102
uses: actions/checkout@v4

0 commit comments

Comments
 (0)