gitshark

Clone repository

git clone https://gitshark.de/git/workaround/Gitshark.git
git clone git@gitshark.de:workaround/Gitshark.git
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

  sonar:
    # SonarQube Community Build analyses the main branch only (no PR decoration),
    # so this runs on push-to-main after tests pass. `verify` regenerates the
    # combined JaCoCo report the scanner picks up via sonar.coverage.jacoco.xmlReportPaths.
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    needs: [jvm-tests]
    steps:
      - uses: actions/checkout@v7
        with:
          # Full history so Sonar can attribute new code / blame correctly.
          fetch-depth: 0
      - uses: actions/setup-java@v5
        with:
          distribution: temurin
          java-version: '21'
          cache: maven
      - name: Sonar analysis
        env:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          SONAR_HOST_URL: https://sonar.ha1nz.de
        run: >-
          ./mvnw -B verify
          org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
          -Dsonar.projectKey=git-shark
          -Dsonar.projectName=git-shark

  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

Keyboard shortcuts

?Show this help
g hGo home
EscClose dialog