name: JVM
on:
push:
branches: [main]
pull_request:
jobs:
jvm-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
cache: maven
- name: Run JVM tests
run: ./mvnw -B test
jvm-image-smoke:
# The documented Compose setup relies on the image shipping /data mount points
# owned by the runtime UID (185) so freshly created named volumes inherit that
# ownership. Build the image and verify it before anything gets published.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
cache: maven
- name: Build application
run: ./mvnw -B package -DskipTests
- name: Build JVM image
run: docker build -f src/main/docker/Dockerfile.jvm -t git-shark:smoke .
- name: Smoke-test /data volume ownership
run: ./src/main/docker/smoke-test-volumes.sh git-shark:smoke 185
jvm-image:
# Build the application and publish the JVM container image to GHCR after tests pass.
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [jvm-tests, jvm-image-smoke]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
cache: maven
- name: Build application
run: ./mvnw -B package -DskipTests
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# QEMU + Buildx enable cross-building the arm64 variant on the amd64 runner.
# The JVM image only copies the (architecture-independent) quarkus-app jars, so no
# per-architecture compilation is needed; the multi-arch base image does the rest.
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract image metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha
type=raw,value=latest
- name: Build and push JVM image
uses: docker/build-push-action@v7
with:
context: .
file: src/main/docker/Dockerfile.jvm
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max