-
Notifications
You must be signed in to change notification settings - Fork 112
370 lines (342 loc) · 12.3 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# based on https://github.com/Arcnor/MiyooCFW/blob/ci/.github/workflows/main.yml
name: Build
# Run on changes (including automated ones from the update job), allow manual triggering from the Actions tab
on: [push, pull_request, workflow_dispatch]
jobs:
# https://github.com/MiyooCFW/buildroot/blob/master/.github/workflows/rootfs.yml
build-image:
uses: MiyooCFW/buildroot/.github/workflows/build.yml@master
with:
submodule: buildroot
docker-uclibc:
continue-on-error: true
needs: build-image
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
runs-on: ubuntu-22.04
env:
# github.repository as <account>/<repo>
IMAGE_NAME: miyoocfw/toolchain-shared-uclibc
DOCKERHUB_USERNAME: miyoocfw
steps:
- uses: actions/checkout@v3
# download and extract the artifact
- uses: actions/download-artifact@v3
with:
name: SDK (uClibc)
- run: tar -xvf arm-miyoo-linux-uclibcgnueabi_sdk-buildroot.tar.gz
- name: Log into docker hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
# create token at https://hub.docker.com/settings/security
# token needs to have read, write, and delete permissions - read and write only leads to a login error (wtf?)
# set value at https://github.com/MiyooCFW/toolchain/settings/secrets/actions
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-uclibc
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
docker-musl:
continue-on-error: true
needs: build-image
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
runs-on: ubuntu-22.04
env:
# github.repository as <account>/<repo>
IMAGE_NAME: miyoocfw/toolchain-shared-musl
DOCKERHUB_USERNAME: miyoocfw
steps:
- uses: actions/checkout@v3
# download and extract the artifact
- uses: actions/download-artifact@v3
with:
name: SDK (musl)
- run: tar -xvf arm-miyoo-linux-musleabi_sdk-buildroot.tar.gz
- name: Log into docker hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
# create token at https://hub.docker.com/settings/security
# token needs to have read, write, and delete permissions - read and write only leads to a login error (wtf?)
# set value at https://github.com/MiyooCFW/toolchain/settings/secrets/actions
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-musl
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
docker-uclibc-static:
continue-on-error: true
needs: build-image
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
runs-on: ubuntu-22.04
env:
# github.repository as <account>/<repo>
IMAGE_NAME: miyoocfw/toolchain-static-uclibc
DOCKERHUB_USERNAME: miyoocfw
steps:
- uses: actions/checkout@v3
# download and extract the artifact
- uses: actions/download-artifact@v3
with:
name: SDK (uClibc static)
- run: tar -xvf arm-miyoo-linux-uclibcgnueabi_sdk-buildroot.tar.gz
- name: Log into docker hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
# create token at https://hub.docker.com/settings/security
# token needs to have read, write, and delete permissions - read and write only leads to a login error (wtf?)
# set value at https://github.com/MiyooCFW/toolchain/settings/secrets/actions
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-uclibc
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
docker-musl-static:
continue-on-error: true
needs: build-image
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
runs-on: ubuntu-22.04
env:
# github.repository as <account>/<repo>
IMAGE_NAME: miyoocfw/toolchain-static-musl
DOCKERHUB_USERNAME: miyoocfw
steps:
- uses: actions/checkout@v3
# download and extract the artifact
- uses: actions/download-artifact@v3
with:
name: SDK (musl static)
- run: tar -xvf arm-miyoo-linux-musleabi_sdk-buildroot.tar.gz
- name: Log into docker hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
# create token at https://hub.docker.com/settings/security
# token needs to have read, write, and delete permissions - read and write only leads to a login error (wtf?)
# set value at https://github.com/MiyooCFW/toolchain/settings/secrets/actions
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-musl
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# https://github.com/MiyooCFW/uboot/blob/master/.github/workflows/main.yml
uboot:
needs:
- docker-uclibc
- docker-musl
uses: MiyooCFW/uboot/.github/workflows/main.yml@master
with:
submodule: uboot
# https://github.com/MiyooCFW/kernel/blob/master/.github/workflows/build.yml
kernel:
needs:
- docker-uclibc
- docker-musl
uses: MiyooCFW/kernel/.github/workflows/build.yml@master
with:
submodule: kernel
# https://github.com/MiyooCFW/logo/blob/master/.github/workflows/c-cpp.yml
logo:
needs:
- docker-uclibc
- docker-musl
uses: MiyooCFW/logo/.github/workflows/c-cpp.yml@master
with:
submodule: logo
# https://github.com/MiyooCFW/daemon/blob/master/.github/workflows/c-cpp.yml
daemon:
needs:
- docker-uclibc
- docker-musl
uses: MiyooCFW/daemon/.github/workflows/c-cpp.yml@master
with:
submodule: daemon
# https://github.com/MiyooCFW/miyooctl/blob/master/.github/workflows/build.yml
miyooctl:
needs:
- docker-uclibc
- docker-musl
uses: MiyooCFW/miyooctl/.github/workflows/build.yml@master
with:
submodule: miyooctl
# https://github.com/MiyooCFW/gmenu2x/blob/master/.github/workflows/c-cpp.yml
gmenu2x:
needs:
- docker-uclibc
- docker-musl
uses: MiyooCFW/gmenu2x/.github/workflows/c-cpp.yml@master
with:
submodule: gmenu2x
# repack final images for beta release with git commit-tag
fetch-images:
name: MiyooCFW
needs:
- build-image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: echo "version=$GITHUB_REF_NAME-$(git rev-parse --short HEAD)" | sed 's#/#-#g' >> $GITHUB_OUTPUT
id: version
- run: echo "Version ${{ steps.version.outputs.version }}"
- uses: actions/download-artifact@v3
- run: find .
- uses: actions/upload-artifact@v3
with:
# we are using uClibc for backward compatibility & musl for development releases
name: "MiyooCFW-BETA ${{ steps.version.outputs.version }}"
path: "*/*.img"
if-no-files-found: error # 'error', 'warn', 'ignore'; defaults to `warn`
# repack current submodules with git commit-tag
fetch-submodules:
name: MiyooCFW (submodules)
needs:
- uboot
- kernel
- logo
- daemon
- miyooctl
- gmenu2x
- build-image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: echo "version=$GITHUB_REF_NAME-$(git rev-parse --short HEAD)" | sed 's#/#-#g' >> $GITHUB_OUTPUT
id: version
- run: echo "Version ${{ steps.version.outputs.version }}"
- name: Clean main repo files
run: rm -r *
- uses: actions/download-artifact@v3
- name: Remove images and graphs from submodule pack
run: rm -r *image* *graph* *log* MiyooCFW*
- name: Move all left artifacts to "submodules" dir
run: |
shopt -s extglob
mkdir submodules && mv !(submodules|*/) submodules/
- name: List uploaded files
run: find .
- uses: actions/upload-artifact@v3
with:
name: "MiyooCFW-submodules ${{ steps.version.outputs.version }}"
path: submodules
if-no-files-found: error # 'error', 'warn', 'ignore'; defaults to `warn`
# delete recurring artifacts
purge-artifact:
name: Artifacts cleanup
continue-on-error: true
needs:
- fetch-images
- fetch-submodules
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: "!MiyooCFW*"