25
25
SETUP_BUILDKIT_IMAGE : " moby/buildkit:latest"
26
26
IMAGE_NAME : " moby/buildkit"
27
27
PLATFORMS : " linux/amd64,linux/arm/v7,linux/arm64,linux/s390x,linux/ppc64le,linux/riscv64"
28
- CACHE_GHA_SCOPE_BINARIES : " binaries"
29
- CACHE_GHA_SCOPE_CROSS : " cross"
30
28
31
29
jobs :
32
- base :
33
- runs-on : ubuntu-20.04
34
- steps :
35
- -
36
- name : Checkout
37
- uses : actions/checkout@v3
38
- -
39
- name : Expose GitHub Runtime
40
- uses : crazy-max/ghaction-github-runtime@v2
41
- -
42
- name : Set up QEMU
43
- uses : docker/setup-qemu-action@v2
44
- -
45
- name : Set up Docker Buildx
46
- uses : docker/setup-buildx-action@v2
47
- with :
48
- version : ${{ env.SETUP_BUILDX_VERSION }}
49
- driver-opts : image=${{ env.SETUP_BUILDKIT_IMAGE }}
50
- buildkitd-flags : --debug
51
- -
52
- name : Build ${{ env.CACHE_GHA_SCOPE_BINARIES }}
53
- run : |
54
- ./hack/build_ci_first_pass binaries
55
- env :
56
- CACHE_FROM : type=gha,scope=${{ env.CACHE_GHA_SCOPE_BINARIES }}
57
- CACHE_TO : type=gha,scope=${{ env.CACHE_GHA_SCOPE_BINARIES }}
58
-
59
30
test :
60
31
uses : ./.github/workflows/.test.yml
61
32
with :
@@ -80,41 +51,15 @@ jobs:
80
51
skip-integration-tests: 1
81
52
typ: integration
82
53
83
- cross :
84
- runs-on : ubuntu-20.04
85
- steps :
86
- -
87
- name : Checkout
88
- uses : actions/checkout@v3
89
- -
90
- name : Expose GitHub Runtime
91
- uses : crazy-max/ghaction-github-runtime@v2
92
- -
93
- name : Set up QEMU
94
- uses : docker/setup-qemu-action@v2
95
- -
96
- name : Set up Docker Buildx
97
- uses : docker/setup-buildx-action@v2
98
- with :
99
- version : ${{ env.SETUP_BUILDX_VERSION }}
100
- driver-opts : image=${{ env.SETUP_BUILDKIT_IMAGE }}
101
- buildkitd-flags : --debug
102
- -
103
- name : Cross
104
- run : |
105
- ./hack/cross
106
- env :
107
- PLATFORMS : ${{ env.PLATFORMS }},darwin/amd64,darwin/arm64,windows/amd64,windows/arm64
108
- CACHE_FROM : type=gha,scope=${{ env.CACHE_GHA_SCOPE_CROSS }}
109
- CACHE_TO : type=gha,scope=${{ env.CACHE_GHA_SCOPE_CROSS }}
110
-
111
- release-base :
54
+ prepare :
112
55
runs-on : ubuntu-20.04
113
56
outputs :
114
57
tag : ${{ steps.prep.outputs.tag }}
115
58
push : ${{ steps.prep.outputs.push }}
59
+ platforms : ${{ steps.prep.outputs.platforms }}
116
60
steps :
117
- - name : Prepare
61
+ -
62
+ name : Prepare
118
63
id : prep
119
64
run : |
120
65
TAG=pr
@@ -131,20 +76,23 @@ jobs:
131
76
fi
132
77
echo "tag=${TAG}" >>${GITHUB_OUTPUT}
133
78
echo "push=${PUSH}" >>${GITHUB_OUTPUT}
79
+ platforms=$(jq -c -n --argjson str '"${{ env.PLATFORMS }},darwin/amd64,darwin/arm64,windows/amd64,windows/arm64"' '$str|split(",")')
80
+ echo "platforms=$platforms" >>${GITHUB_OUTPUT}
134
81
135
- image :
82
+ cross :
136
83
runs-on : ubuntu-20.04
137
84
needs :
138
- - release-base
139
- - test
140
- - cross
85
+ - prepare
141
86
strategy :
142
87
fail-fast : false
143
88
matrix :
144
- target-stage :
145
- - ' '
146
- - rootless
89
+ platform : ${{ fromJson(needs.prepare.outputs.platforms) }}
147
90
steps :
91
+ -
92
+ name : Prepare
93
+ run : |
94
+ platform=${{ matrix.platform }}
95
+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
148
96
-
149
97
name : Checkout
150
98
uses : actions/checkout@v3
@@ -162,28 +110,61 @@ jobs:
162
110
driver-opts : image=${{ env.SETUP_BUILDKIT_IMAGE }}
163
111
buildkitd-flags : --debug
164
112
-
165
- name : Login to DockerHub
166
- if : needs.release-base.outputs.push == 'push'
167
- uses : docker/login-action@v2
168
- with :
169
- username : ${{ secrets.DOCKERHUB_USERNAME }}
170
- password : ${{ secrets.DOCKERHUB_TOKEN }}
171
- -
172
- name : Build ${{ needs.release-base.outputs.tag }}
113
+ name : Build
173
114
run : |
174
- ./hack/images "${{ needs.release-base .outputs.tag }}" "$IMAGE_NAME" "${{ needs. release-base.outputs.push }}"
115
+ ./hack/release-tar "${{ needs.prepare .outputs.tag }}" release-out
175
116
env :
176
117
RELEASE : ${{ startsWith(github.ref, 'refs/tags/v') }}
177
- TARGET : ${{ matrix.target-stage }}
178
- CACHE_FROM : type=gha,scope=${{ env.CACHE_GHA_SCOPE_CROSS }} type=gha,scope=image${{ matrix.target-stage }}
179
- CACHE_TO : type=gha,scope=image${{ matrix.target-stage }}
118
+ PLATFORMS : ${{ matrix.platform }}
119
+ CACHE_FROM : type=gha,scope=cross-${{ env.PLATFORM_PAIR }}
120
+ CACHE_TO : type=gha,scope=cross-${{ env.PLATFORM_PAIR }}
121
+ -
122
+ name : Upload artifacts
123
+ uses : actions/upload-artifact@v3
124
+ with :
125
+ name : buildkit
126
+ path : ./release-out/*
127
+ if-no-files-found : error
180
128
181
129
binaries :
182
130
runs-on : ubuntu-20.04
183
131
needs :
184
- - release-base
185
- - test
132
+ - prepare
186
133
- cross
134
+ - test
135
+ steps :
136
+ -
137
+ name : Download artifacts
138
+ uses : actions/download-artifact@v3
139
+ with :
140
+ name : buildkit
141
+ path : ./release-out/*
142
+ -
143
+ name : List artifacts
144
+ run : |
145
+ tree -nh ./release-out/
146
+ -
147
+ name : GitHub Release
148
+ if : startsWith(github.ref, 'refs/tags/v')
149
+ uses : softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
150
+ env :
151
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
152
+ with :
153
+ draft : true
154
+ files : ./release-out/*
155
+ name : ${{ needs.prepare.outputs.tag }}
156
+
157
+ image :
158
+ runs-on : ubuntu-20.04
159
+ needs :
160
+ - prepare
161
+ - test
162
+ strategy :
163
+ fail-fast : false
164
+ matrix :
165
+ target-stage :
166
+ - ' '
167
+ - rootless
187
168
steps :
188
169
-
189
170
name : Checkout
@@ -202,27 +183,18 @@ jobs:
202
183
driver-opts : image=${{ env.SETUP_BUILDKIT_IMAGE }}
203
184
buildkitd-flags : --debug
204
185
-
205
- name : Build ${{ needs.release-base.outputs.tag }}
206
- run : |
207
- ./hack/release-tar "${{ needs.release-base.outputs.tag }}" release-out
208
- env :
209
- RELEASE : ${{ startsWith(github.ref, 'refs/tags/v') }}
210
- PLATFORMS : ${{ env.PLATFORMS }},darwin/amd64,darwin/arm64,windows/amd64,windows/arm64
211
- CACHE_FROM : type=gha,scope=${{ env.CACHE_GHA_SCOPE_BINARIES }} type=gha,scope=${{ env.CACHE_GHA_SCOPE_CROSS }}
212
- -
213
- name : Upload artifacts
214
- uses : actions/upload-artifact@v3
186
+ name : Login to DockerHub
187
+ if : needs.prepare.outputs.push == 'push'
188
+ uses : docker/login-action@v2
215
189
with :
216
- name : buildkit
217
- path : ./release-out/*
218
- if-no-files-found : error
190
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
191
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
219
192
-
220
- name : GitHub Release
221
- if : startsWith(github.ref, 'refs/tags/v')
222
- uses : softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
193
+ name : Build ${{ needs.prepare.outputs.tag }}
194
+ run : |
195
+ ./hack/images "${{ needs.prepare.outputs.tag }}" "$IMAGE_NAME" "${{ needs.prepare.outputs.push }}"
223
196
env :
224
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
225
- with :
226
- draft : true
227
- files : ./release-out/*
228
- name : ${{ needs.release-base.outputs.tag }}
197
+ RELEASE : ${{ startsWith(github.ref, 'refs/tags/v') }}
198
+ TARGET : ${{ matrix.target-stage }}
199
+ CACHE_FROM : type=gha,scope=image${{ matrix.target-stage }}
200
+ CACHE_TO : type=gha,scope=image${{ matrix.target-stage }}
0 commit comments