Skip to content

Multi arch seminar

Multi arch seminar #2

Workflow file for this run

name: CI Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- "**"
env:
IMAGE_REGISTRY: ghcr.io/hu1buerger/explorviz-span-service # TODO: set in github as env var
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "graalvm"
java-version: "21"
- name: Cache Gradle Packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Build Project
run: ./gradlew assemble
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
pmd:
name: PMD Analysis
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "graalvm"
java-version: "21"
- name: Cache Gradle Packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Run PMD Analysis
run: ./gradlew pmdMain
checkstyle:
name: Checkstyle Analysis
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "graalvm"
java-version: "21"
- name: Cache Gradle Packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Run Checkstyle
run: ./gradlew checkstyleMain
unit-test:
name: Unit Tests
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "graalvm"
java-version: "21"
- name: Cache Gradle Packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Run Unit Tests
run: ./gradlew test
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: build
continue-on-error: true
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "graalvm"
java-version: "21"
- name: Cache Gradle Packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Run Integration Tests
run: ./gradlew integrationTest
- uses: actions/upload-artifact@v4 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: test-results-integration
path: build/reports/tests/integrationTest/index.html
# Combine test reports if needed
test-report:
name: Test Report
runs-on: ubuntu-latest
if: always()
needs: [unit-test, integration-test]
steps:
- uses: dorny/test-reporter@v1
with:
artifact: /test-results-(.*)/ # artifact name
name: java-junit # Name of the check run which will be created
path: "*.html" # Path to test results (inside artifact .zip)
reporter: jest-junit # Format of test results
test:
name: test end node
runs-on: ubuntu-latest
needs: [build, pmd, checkstyle, unit-test]
steps:
- run: echo "finished test stage" # this is a indirection to the previous test steps
push-dockerhub-native-main-amd64:
name: Push Native Image (AMD64)
runs-on: ubuntu-latest
needs: [test]
#if: github.ref == 'refs/heads/main'
if: false
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Build and Deploy Quarkus Native Image
uses: ./.github/actions/build-and-deploy-quarkus-native
with:
image-name: ${{ vars.DOCKER_IMAGE_NAME }}
image-tag: "amd64"
reg-username: ${{ secrets.DOCKER_USERNAME }}
reg-token: ${{ secrets.DOCKER_PASSWORD }}
push-dockerhub-native-main-arm64:
name: Push Native Image (ARM64)
runs-on: ubuntu-latest
if: false
needs: [test]
#FIXME if: github.ref == 'refs/heads/main' && env.ARM64_BUILD == 'true'
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup ARM64 Emulation
run: |
sudo apt-get update
sudo apt-get install -y qemu binfmt-support qemu-user-static
docker run --privileged --rm tonistiigi/binfmt --install all
- name: Build and Deploy Quarkus Native Image
uses: ./.github/actions/build-and-deploy-quarkus-native
with:
image-name: ${{ vars.DOCKER_IMAGE_NAME }}
image-tag: "arm64"
reg-username: ${{ secrets.DOCKER_USERNAME }}
reg-token: ${{ secrets.DOCKER_PASSWORD }}
docker-image-native:
name: Docker image native
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: setup quarkus-cli
uses: ./.github/actions/setup-quarkus
- run: quarkus image build docker
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup ARM64 Emulation
run: |
sudo apt-get update
sudo apt-get install -y qemu binfmt-support qemu-user-static
docker run --privileged --rm tonistiigi/binfmt --install all
- run: quarkus image push --native --registry ghcr.io --registry-username=${{ secrets.DOCKER_USERNAME }} --registry-password=${{ secrets.DOCKER_PASSWORD }} --group ${{github.repository_owner}} -Dquarkus.container-image.builder=docker -D quarkus.docker.buildx.platform=linux/amd64,linux/arm64
docker-image-jvm:
name: Docker image JVM
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: setup quarkus-cli
uses: ./.github/actions/setup-quarkus
- run: quarkus image build docker
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Setup ARM64 Emulation for multi arch build
run: |
sudo apt-get update
sudo apt-get install -y qemu binfmt-support qemu-user-static
docker run --privileged --rm tonistiigi/binfmt --install all
- run: |
quarkus image push \
--registry ghcr.io \
--registry-username=${{ secrets.DOCKER_USERNAME }} \
--registry-password=${{ secrets.DOCKER_PASSWORD }} \
--group ${{github.repository_owner}} \
-Dquarkus.container-image.builder=docker \
-D quarkus.docker.buildx.platform=linux/amd64,linux/arm64