Test docker multi-platform #141
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test docker multi-platform | |
| on: | |
| # # Uncomment when test added first time to register workflow and comment it back after workflow would be registered | |
| # # | |
| # # Added pull_request to register workflow from the PR. | |
| # # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo | |
| # pull_request: {} | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: "The fully-formed ref of the branch or tag that triggered the workflow run" | |
| required: false | |
| type: "string" | |
| sha: | |
| description: "The sha of the commit that triggered the workflow run" | |
| required: false | |
| type: "string" | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup | |
| run: echo "Do setup" | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: [setup] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - uses: ./ | |
| id: current | |
| with: | |
| workdir: ./test/custom | |
| file: Dockerfile_multi_platform | |
| organization: ${{ github.event.repository.owner.login }} | |
| repository: ${{ github.event.repository.name }} | |
| registry: registry.hub.docker.com | |
| login: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| type=sha,format=long,suffix=-multi-platform,priority=1002 | |
| - name: Inspect Image | |
| id: inspect | |
| run: | | |
| json=$(docker buildx imagetools inspect ${{ steps.current.outputs.image }}:${{ steps.current.outputs.tag }} --raw ) | |
| archs=$(echo $json | jq '[.manifests[] | .platform | select(.os != "unknown") | "\(.os)/\(.architecture)"] | join(",")') | |
| echo "archs=$archs" >> $GITHUB_ENV | |
| - uses: nick-fields/assert-action@v2 | |
| with: | |
| expected: 'registry.hub.docker.com/cloudposse/github-action-docker-build-push' | |
| actual: ${{ steps.current.outputs.image }} | |
| - uses: nick-fields/assert-action@v2 | |
| with: | |
| expected: sha-${{ github.sha }}-multi-platform | |
| actual: ${{ steps.current.outputs.tag }} | |
| - uses: nick-fields/assert-action@v2 | |
| with: | |
| expected: 'linux/amd64' | |
| actual: ${{ env.archs }} | |
| comparison: contains | |
| - uses: nick-fields/assert-action@v2 | |
| with: | |
| expected: 'linux/arm64' | |
| actual: ${{ env.archs }} | |
| comparison: contains | |
| teardown: | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| if: ${{ always() }} | |
| steps: | |
| - name: Tear down | |
| run: echo "Do Tear down" |