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,42 +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
- RUNC_PLATFORMS : ${{ env.PLATFORMS }}
109
- CACHE_FROM : type=gha,scope=${{ env.CACHE_GHA_SCOPE_CROSS }}
110
- CACHE_TO : type=gha,scope=${{ env.CACHE_GHA_SCOPE_CROSS }}
111
-
112
- release-base :
54
+ prepare :
113
55
runs-on : ubuntu-20.04
114
56
outputs :
115
57
tag : ${{ steps.prep.outputs.tag }}
116
58
push : ${{ steps.prep.outputs.push }}
59
+ platforms : ${{ steps.prep.outputs.platforms }}
117
60
steps :
118
- - name : Prepare
61
+ -
62
+ name : Prepare
119
63
id : prep
120
64
run : |
121
65
TAG=pr
@@ -132,20 +76,23 @@ jobs:
132
76
fi
133
77
echo "tag=${TAG}" >>${GITHUB_OUTPUT}
134
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}
135
81
136
- image :
82
+ cross :
137
83
runs-on : ubuntu-20.04
138
84
needs :
139
- - release-base
140
- - test
141
- - cross
85
+ - prepare
142
86
strategy :
143
87
fail-fast : false
144
88
matrix :
145
- target-stage :
146
- - ' '
147
- - rootless
89
+ platform : ${{ fromJson(needs.prepare.outputs.platforms) }}
148
90
steps :
91
+ -
92
+ name : Prepare
93
+ run : |
94
+ platform=${{ matrix.platform }}
95
+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
149
96
-
150
97
name : Checkout
151
98
uses : actions/checkout@v3
@@ -163,28 +110,33 @@ jobs:
163
110
driver-opts : image=${{ env.SETUP_BUILDKIT_IMAGE }}
164
111
buildkitd-flags : --debug
165
112
-
166
- name : Login to DockerHub
167
- if : needs.release-base.outputs.push == 'push'
168
- uses : docker/login-action@v2
169
- with :
170
- username : ${{ secrets.DOCKERHUB_USERNAME }}
171
- password : ${{ secrets.DOCKERHUB_TOKEN }}
172
- -
173
- name : Build ${{ needs.release-base.outputs.tag }}
113
+ name : Build
174
114
run : |
175
- ./hack/images "${{ needs.release-base .outputs.tag }}" "$IMAGE_NAME" "${{ needs. release-base.outputs.push }}"
115
+ ./hack/release-tar "${{ needs.prepare .outputs.tag }}" release-out
176
116
env :
177
117
RELEASE : ${{ startsWith(github.ref, 'refs/tags/v') }}
178
- TARGET : ${{ matrix.target-stage }}
179
- CACHE_FROM : type=gha,scope=${{ env.CACHE_GHA_SCOPE_CROSS }} type=gha,scope=image${{ matrix.target-stage }}
180
- 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
181
128
182
- binaries :
129
+ image :
183
130
runs-on : ubuntu-20.04
184
131
needs :
185
- - release-base
132
+ - prepare
186
133
- test
187
- - cross
134
+ strategy :
135
+ fail-fast : false
136
+ matrix :
137
+ target-stage :
138
+ - ' '
139
+ - rootless
188
140
steps :
189
141
-
190
142
name : Checkout
@@ -203,27 +155,47 @@ jobs:
203
155
driver-opts : image=${{ env.SETUP_BUILDKIT_IMAGE }}
204
156
buildkitd-flags : --debug
205
157
-
206
- name : Build ${{ needs.release-base.outputs.tag }}
158
+ name : Login to DockerHub
159
+ if : needs.prepare.outputs.push == 'push'
160
+ uses : docker/login-action@v2
161
+ with :
162
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
163
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
164
+ -
165
+ name : Build ${{ needs.prepare.outputs.tag }}
207
166
run : |
208
- ./hack/release-tar "${{ needs.release-base .outputs.tag }}" release-out
167
+ ./hack/images "${{ needs.prepare .outputs.tag }}" "$IMAGE_NAME" "${{ needs.prepare.outputs.push }}"
209
168
env :
210
169
RELEASE : ${{ startsWith(github.ref, 'refs/tags/v') }}
211
- PLATFORMS : ${{ env.PLATFORMS }},darwin/amd64,darwin/arm64,windows/amd64,windows/arm64
212
- CACHE_FROM : type=gha,scope=${{ env.CACHE_GHA_SCOPE_BINARIES }} type=gha,scope=${{ env.CACHE_GHA_SCOPE_CROSS }}
170
+ TARGET : ${{ matrix.target-stage }}
171
+ CACHE_FROM : type=gha,scope=image${{ matrix.target-stage }}
172
+ CACHE_TO : type=gha,scope=image${{ matrix.target-stage }}
173
+
174
+ release :
175
+ runs-on : ubuntu-20.04
176
+ needs :
177
+ - prepare
178
+ - test
179
+ - cross
180
+ - image
181
+ steps :
213
182
-
214
- name : Upload artifacts
215
- uses : actions/upload -artifact@v3
183
+ name : Download artifacts
184
+ uses : actions/download -artifact@v3
216
185
with :
217
186
name : buildkit
218
187
path : ./release-out/*
219
- if-no-files-found : error
188
+ -
189
+ name : List artifacts
190
+ run : |
191
+ tree -nh ./release-out/
220
192
-
221
193
name : GitHub Release
222
194
if : startsWith(github.ref, 'refs/tags/v')
223
- uses : softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
195
+ uses : softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
224
196
env :
225
197
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
226
198
with :
227
199
draft : true
228
200
files : ./release-out/*
229
- name : ${{ needs.release-base .outputs.tag }}
201
+ name : ${{ needs.prepare .outputs.tag }}
0 commit comments