1313
1414jobs :
1515 build :
16+ permissions :
17+ # for MaxymVlasov/dive-action to write comments to PRs
18+ pull-requests : write
19+
1620 strategy :
1721 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
2033
34+ name : ${{ matrix.os-name }}
2135 runs-on : ${{ matrix.os }}
2236 steps :
2337 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -37,21 +51,17 @@ jobs:
3751 tools/*.sh
3852
3953 - name : Set IMAGE environment variable
54+ if : steps.changed-files-specific.outputs.any_changed == 'true'
4055 # Lowercase the org/repo name to allow for workflow to run in forks,
4156 # which owners have uppercase letters in username
4257 run : >-
4358 echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}:${{ env.IMAGE_TAG }}"
4459 >> $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
5160
5261 - name : Set up Docker Buildx
5362 # yamllint disable-line rule:line-length
5463 uses : docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
64+ if : steps.changed-files-specific.outputs.any_changed == 'true'
5565
5666 - name : Build if Dockerfile changed
5767 if : steps.changed-files-specific.outputs.any_changed == 'true'
6171 context : .
6272 build-args : |
6373 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 }}
6774 push : false
6875 load : true
6976 tags : ${{ env.IMAGE }}
@@ -72,18 +79,34 @@ jobs:
7279 secrets : |
7380 "github_token=${{ secrets.GITHUB_TOKEN }}"
7481
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+
7598 - name : Run structure tests
7699 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 }}
82105
83106 - name : Dive - check image for waste files
84107 if : steps.changed-files-specific.outputs.any_changed == 'true'
85108 # yamllint disable-line rule:line-length
86- uses : MaxymVlasov/dive-action@379af3fc636888ada5899c997e8b52db6ad45023 # v1.0.1
109+ uses : MaxymVlasov/dive-action@b6a02b38f0f309e8817199658eab090d4f0f93ce # v1.1.0
87110 with :
88111 image : ${{ env.IMAGE }}
89112 config-file : ${{ github.workspace }}/.github/.dive-ci.yaml
95118 if : >-
96119 steps.changed-files-specific.outputs.any_changed == 'true'
97120 && matrix.os == 'ubuntu-latest'
98- && matrix.arch == 'amd64'
99121 # yamllint disable-line rule:line-length
100122 uses : docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0
101123 with :
0 commit comments