13
13
14
14
jobs :
15
15
build :
16
+ permissions :
17
+ # for MaxymVlasov/dive-action to write comments to PRs
18
+ pull-requests : write
19
+
16
20
strategy :
17
21
matrix :
18
- os : [ubuntu-latest]
19
- arch : [amd64, arm64]
22
+ arch :
23
+ - amd64
24
+ - arm64
25
+ include :
26
+ - os-name : Ubuntu x64
27
+ os : ubuntu-latest
28
+ arch : amd64
29
+
30
+ - os-name : Ubuntu ARM
31
+ os : ubuntu-24.04-arm
32
+ arch : arm64
20
33
34
+ name : ${{ matrix.os-name }}
21
35
runs-on : ${{ matrix.os }}
22
36
steps :
23
37
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -37,21 +51,17 @@ jobs:
37
51
tools/*.sh
38
52
39
53
- name : Set IMAGE environment variable
54
+ if : steps.changed-files-specific.outputs.any_changed == 'true'
40
55
# Lowercase the org/repo name to allow for workflow to run in forks,
41
56
# which owners have uppercase letters in username
42
57
run : >-
43
58
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}:${{ env.IMAGE_TAG }}"
44
59
>> $GITHUB_ENV
45
- - name : Set up QEMU
46
- if : matrix.os != 'ubuntu-latest' || matrix.arch != 'amd64'
47
- # yamllint disable-line rule:line-length
48
- uses : docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a # v3.3.0
49
- with :
50
- platforms : arm64
51
60
52
61
- name : Set up Docker Buildx
53
62
# yamllint disable-line rule:line-length
54
63
uses : docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
64
+ if : steps.changed-files-specific.outputs.any_changed == 'true'
55
65
56
66
- name : Build if Dockerfile changed
57
67
if : steps.changed-files-specific.outputs.any_changed == 'true'
61
71
context : .
62
72
build-args : |
63
73
INSTALL_ALL=true
64
- # yamllint disable-line rule:line-length
65
- platforms : >- # Only one allowed here, see https://github.com/docker/buildx/issues/59#issuecomment-1433097926
66
- linux/${{ matrix.arch }}
67
74
push : false
68
75
load : true
69
76
tags : ${{ env.IMAGE }}
@@ -72,18 +79,34 @@ jobs:
72
79
secrets : |
73
80
"github_token=${{ secrets.GITHUB_TOKEN }}"
74
81
82
+ - name : Setup Container Structure Tests
83
+ if : steps.changed-files-specific.outputs.any_changed == 'true'
84
+ env :
85
+ # yamllint disable-line rule:line-length
86
+ # renovate: datasource=github-releases depName=container-structure-test lookupName=GoogleContainerTools/container-structure-test
87
+ CST_VERSION : 1.19.3
88
+ CST_REPO : github.com/GoogleContainerTools/container-structure-test
89
+ run : >-
90
+ curl -L "https://${{ env.CST_REPO }}/releases/download/v${{
91
+ env.CST_VERSION }}/container-structure-test-linux-${{ matrix.arch }}"
92
+ > container-structure-test
93
+ && chmod +x container-structure-test
94
+ && mkdir -p $HOME/bin/
95
+ && mv container-structure-test $HOME/bin/
96
+ && echo $HOME/bin/ >> $GITHUB_PATH
97
+
75
98
- name : Run structure tests
76
99
if : steps.changed-files-specific.outputs.any_changed == 'true'
77
- # yamllint disable-line rule:line-length
78
- uses : plexsystems/ container-structure-test-action@c0a028aa96e8e82ae35be556040340cbb3e280ca # v0.3.0
79
- with :
80
- image : ${{ env.IMAGE }}
81
- config : .github/.container-structure-test-config.yaml
100
+ run : >-
101
+ container-structure-test test
102
+ --config ${{ github.workspace
103
+ }}/.github/.container-structure-test-config.yaml
104
+ --image ${{ env.IMAGE }}
82
105
83
106
- name : Dive - check image for waste files
84
107
if : steps.changed-files-specific.outputs.any_changed == 'true'
85
108
# yamllint disable-line rule:line-length
86
- uses : MaxymVlasov/dive-action@379af3fc636888ada5899c997e8b52db6ad45023 # v1.0.1
109
+ uses : MaxymVlasov/dive-action@b6a02b38f0f309e8817199658eab090d4f0f93ce # v1.1.0
87
110
with :
88
111
image : ${{ env.IMAGE }}
89
112
config-file : ${{ github.workspace }}/.github/.dive-ci.yaml
95
118
if : >-
96
119
steps.changed-files-specific.outputs.any_changed == 'true'
97
120
&& matrix.os == 'ubuntu-latest'
98
- && matrix.arch == 'amd64'
99
121
# yamllint disable-line rule:line-length
100
122
uses : docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0
101
123
with :
0 commit comments