name: Native
on:
push:
branches: [main]
pull_request:
jobs:
native-build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
cache: maven
- name: Native build & integration tests
run: ./mvnw -B verify -Dnative -Dquarkus.native.container-build=true
# The documented Compose setup relies on the image shipping /data mount points
# owned by the runtime UID (1001 in the native image) so freshly created named
# volumes inherit that ownership. Verify before the image gets published.
- name: Build native image for smoke test
run: docker build -f src/main/docker/Dockerfile.native-micro -t git-shark:native-smoke .
- name: Smoke-test /data volume ownership
run: ./src/main/docker/smoke-test-volumes.sh git-shark:native-smoke 1001
# Publish the native image to GHCR after the build and integration tests pass.
# The native executable is architecture-specific and was compiled on this amd64
# runner, so the image is published for linux/amd64 only (the multi-arch manifest
# is the JVM image's job).
- name: Log in to GHCR
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: docker/setup-buildx-action@v3
- name: Extract image metadata
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
flavor: |
suffix=-native,onlatest=true
tags: |
type=sha
type=raw,value=latest
- name: Build and push native image
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: docker/build-push-action@v7
with:
context: .
file: src/main/docker/Dockerfile.native-micro
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}