Skip to content

Commit

Permalink
feat(ci): run on real arm64 builders
Browse files Browse the repository at this point in the history
Emulated arm64 builds are slow. Fortunately, GitHub has real Linux ARM64
hardware these days, so let's switch to it.
  • Loading branch information
iainlane committed Oct 7, 2024
1 parent 1cfbdf8 commit cd2afff
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ env:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
- ubuntu-latest
- github-hosted-ubuntu-arm64

runs-on: ${{ matrix.platform }}

steps:
- name: Checkout
Expand All @@ -54,29 +55,28 @@ jobs:
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1

- name: Login to DockerHub
if: github.event_name == 'push'
if: github.event_name != 'pull_request'
uses: grafana/shared-workflows/actions/dockerhub-login@main

- name: Build and push by digest
id: build
uses: docker/build-push-action@32945a339266b759abcbdc89316275140b0fc960 # v6.8.0
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ github.event_name == 'push' }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}

- name: Export digest
id: digest
if: github.event_name == 'push'
if: github.event_name != 'pull_request'
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
echo "artifact_name=digests-${{ matrix.platform }}" | sed -e 's/\//-/g' >> "$GITHUB_OUTPUT"
- name: Upload digest
if: github.event_name == 'push'
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: ${{ steps.digest.outputs.artifact_name }}
Expand All @@ -86,20 +86,20 @@ jobs:

merge:
runs-on: ubuntu-latest
if: github.event_name == 'push'
if: github.event_name != 'pull_request'
needs:
- build
steps:
- name: Download digests (linux/amd64)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: digests-linux-amd64
name: digests-github-hosted-ubuntu-arm64
path: /tmp/digests-linux-amd64

- name: Download digests (linux/arm64)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: digests-linux-arm64
name: digests-ubuntu-latest
path: /tmp/digests-linux-arm64

- name: Merge digests
Expand Down

0 comments on commit cd2afff

Please sign in to comment.