forked from moby/buildkit
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (81 loc) · 2.56 KB
/
validate.yml
File metadata and controls
87 lines (81 loc) · 2.56 KB
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
name: validate
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- 'master'
- 'v[0-9]+.[0-9]+'
tags:
- 'v*'
- 'dockerfile/*'
pull_request:
env:
SETUP_BUILDX_VERSION: "edge"
SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest"
jobs:
prepare:
runs-on: ubuntu-24.04
outputs:
includes: ${{ steps.matrix.outputs.includes }}
steps:
-
name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
-
name: Generate matrix
id: generate
uses: docker/bake-action/subaction/matrix@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7.0.0
with:
target: validate
fields: platforms
env:
GOLANGCI_LINT_MULTIPLATFORM: ${{ github.repository == 'moby/buildkit' && '1' || '' }}
ARCHUTIL_MULTIPLATFORM: ${{ github.repository == 'moby/buildkit' && '1' || '' }}
-
name: Add runner to matrix
id: matrix
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
INPUT_MATRIX: ${{ steps.generate.outputs.matrix }}
INPUT_PRIVATE-REPO: ${{ github.event.repository.private }}
with:
script: |
const matrix = JSON.parse(core.getInput('matrix'));
const privateRepo = core.getBooleanInput('private-repo');
matrix.forEach(job => {
if (job.platforms && job.platforms.startsWith('linux/arm') && !privateRepo) {
job.runner = 'ubuntu-24.04-arm';
} else {
job.runner = 'ubuntu-24.04';
}
});
core.info(JSON.stringify(matrix, null, 2));
core.setOutput('includes', JSON.stringify(matrix));
validate:
runs-on: ${{ matrix.runner }}
needs:
- prepare
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.prepare.outputs.includes) }}
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
with:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Validate
uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7.0.0
with:
targets: ${{ matrix.target }}
set: |
*.platform=${{ matrix.platforms }}