diff --git a/.github/workflows/build-image-test.yaml b/.github/workflows/build-image-test.yaml index f39770b9b..7cc6c3086 100644 --- a/.github/workflows/build-image-test.yaml +++ b/.github/workflows/build-image-test.yaml @@ -13,11 +13,25 @@ env: jobs: build: + permissions: + # for MaxymVlasov/dive-action to write comments to PRs + pull-requests: write + strategy: matrix: - os: [ubuntu-latest] - arch: [amd64, arm64] + arch: + - amd64 + - arm64 + include: + - os-name: Ubuntu x64 + os: ubuntu-latest + arch: amd64 + + - os-name: Ubuntu ARM + os: ubuntu-24.04-arm + arch: arm64 + name: ${{ matrix.os-name }} runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -37,21 +51,17 @@ jobs: tools/*.sh - name: Set IMAGE environment variable + if: steps.changed-files-specific.outputs.any_changed == 'true' # Lowercase the org/repo name to allow for workflow to run in forks, # which owners have uppercase letters in username run: >- echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}:${{ env.IMAGE_TAG }}" >> $GITHUB_ENV - - name: Set up QEMU - if: matrix.os != 'ubuntu-latest' || matrix.arch != 'amd64' - # yamllint disable-line rule:line-length - uses: docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a # v3.3.0 - with: - platforms: arm64 - name: Set up Docker Buildx # yamllint disable-line rule:line-length uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 + if: steps.changed-files-specific.outputs.any_changed == 'true' - name: Build if Dockerfile changed if: steps.changed-files-specific.outputs.any_changed == 'true' @@ -61,9 +71,6 @@ jobs: context: . build-args: | INSTALL_ALL=true - # yamllint disable-line rule:line-length - platforms: >- # Only one allowed here, see https://github.com/docker/buildx/issues/59#issuecomment-1433097926 - linux/${{ matrix.arch }} push: false load: true tags: ${{ env.IMAGE }} @@ -72,18 +79,34 @@ jobs: secrets: | "github_token=${{ secrets.GITHUB_TOKEN }}" + - name: Setup Container Structure Tests + if: steps.changed-files-specific.outputs.any_changed == 'true' + env: + # yamllint disable-line rule:line-length + # renovate: datasource=github-releases depName=container-structure-test lookupName=GoogleContainerTools/container-structure-test + CST_VERSION: 1.19.3 + CST_REPO: github.com/GoogleContainerTools/container-structure-test + run: >- + curl -L "https://${{ env.CST_REPO }}/releases/download/v${{ + env.CST_VERSION }}/container-structure-test-linux-${{ matrix.arch }}" + > container-structure-test + && chmod +x container-structure-test + && mkdir -p $HOME/bin/ + && mv container-structure-test $HOME/bin/ + && echo $HOME/bin/ >> $GITHUB_PATH + - name: Run structure tests if: steps.changed-files-specific.outputs.any_changed == 'true' - # yamllint disable-line rule:line-length - uses: plexsystems/container-structure-test-action@c0a028aa96e8e82ae35be556040340cbb3e280ca # v0.3.0 - with: - image: ${{ env.IMAGE }} - config: .github/.container-structure-test-config.yaml + run: >- + container-structure-test test + --config ${{ github.workspace + }}/.github/.container-structure-test-config.yaml + --image ${{ env.IMAGE }} - name: Dive - check image for waste files if: steps.changed-files-specific.outputs.any_changed == 'true' # yamllint disable-line rule:line-length - uses: MaxymVlasov/dive-action@379af3fc636888ada5899c997e8b52db6ad45023 # v1.0.1 + uses: MaxymVlasov/dive-action@b6a02b38f0f309e8817199658eab090d4f0f93ce # v1.1.0 with: image: ${{ env.IMAGE }} config-file: ${{ github.workspace }}/.github/.dive-ci.yaml @@ -95,7 +118,6 @@ jobs: if: >- steps.changed-files-specific.outputs.any_changed == 'true' && matrix.os == 'ubuntu-latest' - && matrix.arch == 'amd64' # yamllint disable-line rule:line-length uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0 with: diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index 632d78d10..f70db2148 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -23,9 +23,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up QEMU - # yamllint disable-line rule:line-length - uses: docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a # v3.3.0 - name: Set up Docker Buildx # yamllint disable-line rule:line-length uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0