-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (95 loc) · 2.8 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: build
on:
workflow_dispatch:
push:
branches:
- 'master'
- 'fix/*'
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
core: ${{ steps.step1.outputs.core }}
rest: ${{ steps.step1.outputs.rest }}
all: ${{ steps.step1.outputs.all }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Generate outputs
id: step1
run: |
echo "core=$(./.github/list-subimages --core --json)" >>$GITHUB_OUTPUT
echo "rest=$(./.github/list-subimages --rest --json)" >>$GITHUB_OUTPUT
echo "all=$(./.github/list-subimages --json)" >>$GITHUB_OUTPUT
echo "GITHUB_OUTPUT:"
cat $GITHUB_OUTPUT
build-core:
needs: matrix
strategy:
fail-fast: false
matrix:
subimage: ${{ fromJson(needs.matrix.outputs.core) }}
uses: ./.github/workflows/build-subimage.yml
with:
subimage: ${{ matrix.subimage }}
tags: |
type=sha,format=long
# Here: NOT the full tags, just the sha! (they get added below)
secrets: inherit
build-rest:
needs: [matrix, build-core]
strategy:
fail-fast: false
matrix:
subimage: ${{ fromJson(needs.matrix.outputs.rest) }}
uses: ./.github/workflows/build-subimage.yml
with:
subimage: ${{ matrix.subimage }}
tags: |
type=sha,format=long
secrets: inherit
test:
needs: [matrix, build-rest]
strategy:
fail-fast: false
matrix:
subimage: ${{ fromJson(needs.matrix.outputs.all) }}
runs-on: ubuntu-latest
env:
DOCKER_IMAGE_TAG: sha-${{ github.sha }} # needed to run the correct version through the wrapper
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Install wrapper
run: |
sudo apt-get install -y python3-pip
cd wrapper && pip install .
-
name: Test
run: |
./test-${{ matrix.subimage }}.sh
# At this point, we have successfully built, uploaded and tested the images. We now just need to add
# tags. We do this by building again, but using the formerly built images to
# cache from.
push-with-tags:
needs: [matrix, test]
strategy:
matrix:
subimage: ${{ fromJson(needs.matrix.outputs.all) }}
uses: ./.github/workflows/build-subimage.yml
with:
subimage: ${{ matrix.subimage }}
tags: |
type=sha,format=long
type=edge,branch=master
type=ref,event=branch
type=semver,pattern={{version}}
# Here: full tags
# Note: Do NOT use event=tag here, unless re-configuring the "latest"
# behavior too as that triggers on event=tag by default. By default,
# "latest" triggers on type=semver here, too (which is wanted).
secrets: inherit