Skip to content

Commit

Permalink
Initial work on native ARM64 building
Browse files Browse the repository at this point in the history
  • Loading branch information
spantaleev committed Feb 27, 2025
1 parent a4aef86 commit c3882eb
Showing 1 changed file with 68 additions and 17 deletions.
85 changes: 68 additions & 17 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: CI (main and tags)
on:
push:
branches: [ "main" ]
branches: [ "native-arm64-building" ]
tags: [ "v*" ]
permissions:
checks: write
contents: write
packages: write
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
test-and-clippy:
name: Unit testing and linting
Expand All @@ -20,17 +23,41 @@ jobs:
- run: cargo test --all-features
- run: cargo clippy

build-publish:
name: Build and Publish
runs-on: self-hosted
docker-clean-metadata:
runs-on: ubuntu-latest
outputs:
json: ${{ steps.meta.outputs.json }}
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref_name == 'native-arm64-building' }}
type=semver,pattern={{raw}}
docker-build:
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
include:
- os: ubuntu-latest
arch: amd64
- os: ubuntu-24.04-arm
arch: arm64

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

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
Expand All @@ -40,17 +67,41 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
registry.etke.cc/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
type=raw,value=latest,enable=${{ github.ref_name == 'native-arm64-building' }}
type=semver,pattern={{raw}}
- name: Build and push
flavor: |
latest=auto
suffix=-${{ matrix.arch }},onlatest=true
images: |
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.ci

docker-manifest:
needs:
- docker-build
- docker-clean-metadata
runs-on: ubuntu-latest

strategy:
matrix:
image: ${{ fromJson(needs.docker-clean-metadata.outputs.json).tags }}

steps:
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create and push manifest
run: |
docker manifest create ${{ matrix.image }} ${{ matrix.image }}-amd64 ${{ matrix.image }}-arm64
docker manifest push ${{ matrix.image }}

0 comments on commit c3882eb

Please sign in to comment.