Skip to content

⬆️ Upgrade to Quarkus 2.16.7.Final #16

⬆️ Upgrade to Quarkus 2.16.7.Final

⬆️ Upgrade to Quarkus 2.16.7.Final #16

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: 📈 Business App 📈 - 👷 CI pipeline with Maven 🚀
# This section allows the workflow to create a Release
# https://github.com/softprops/action-gh-release/issues/236#issuecomment-1150530128
permissions:
checks: write
contents: write
pull-requests: write
# This section ensures that new pushes cancel current executions of the workflow
concurrency:
group: business-app
cancel-in-progress: true
on:
push:
branches:
- main
tags:
- 'v.[0-9]+.[0-9]+.[0-9]+'
paths:
- 08-quarkus-business-app/**
#paths-ignore:
# - 'LICENSE'
# - '*.md'
pull_request:
branches:
- main
paths:
- 08-quarkus-business-app/**
#paths-ignore:
# - 'LICENSE'
# - '*.md'
env:
APP_GROUP: eda-workshop
APP_NAME: business-app
APP_WORKSPACE: 08-quarkus-business-app
JAVA_VERSION: "17"
IMAGE_BASE_NAME: "quay.io/eda-workshop/business-app"
jobs:
setup:
runs-on: ubuntu-latest
name: Get Application Version
outputs:
app_version: ${{ steps.get_app_version.outputs.version }}
tag_version: ${{ steps.get_tag_version.outputs.version }}
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
- name: Get version from Maven project
id: get_app_version
working-directory: ${{ env.APP_WORKSPACE }}
run: |
APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Application Version: $APP_VERSION"
echo "version=$APP_VERSION" >> $GITHUB_OUTPUT
- name: Get version from Tag release
id: get_tag_version
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "Application version from Tag release: ${{ github.ref_name }}"
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
name: "Compile"
needs:
- setup
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
- name: Build with Maven
working-directory: ${{ env.APP_WORKSPACE }}
run: |
echo "Building version ${{ needs.setup.outputs.app_version }}"
./mvnw -B package --file pom.xml
#- name: Official SonarQube Scan
# uses: SonarSource/sonarqube-scan-action@v1.0.0
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: ${{ env.APP_WORKSPACE }}/target/surefire-reports/**/*.xml
build-jvm:
runs-on: ubuntu-latest
needs:
- setup
- build
name: "Build Artifact"
steps:
- name: "Checkout the code"
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
- name: "Build executable"
working-directory: ${{ env.APP_WORKSPACE }}
run: ./mvnw install --no-transfer-progress -DskipTests
- name: "Upload executable"
uses: actions/upload-artifact@v3
with:
name: executable
path: ${{ env.APP_WORKSPACE }}/target/quarkus-app/*
push-image:
runs-on: ubuntu-latest
needs:
- setup
- build-jvm
name: "Push Image to Image Registry"
steps:
- name: "Checkout the code"
uses: actions/checkout@v3
- name: "Download the native executable"
uses: actions/download-artifact@v3
with:
name: executable
path: ${{ env.APP_WORKSPACE }}/target/quarkus-app/
- name: "Login to Image Registry"
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_REPO_USERNAME }}
password: ${{ secrets.QUAY_REPO_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v4
with:
push: true
context: ${{ env.APP_WORKSPACE }}
file: ${{ env.APP_WORKSPACE }}/src/main/docker/Dockerfile.jvm
# Hack for pseudo ternary expression: If no tag => Latest, if not, tag value
# Source: https://github.com/orgs/community/discussions/25725#discussioncomment-3248924
tags: ${{ env.IMAGE_BASE_NAME }}:${{ needs.setup.outputs.tag_version || needs.setup.outputs.app_version }}
build-native:
runs-on: ubuntu-latest
needs:
- setup
- push-image
name: "Build Native Artifact"
steps:
- name: "Checkout the code"
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
- name: "Build native executable"
working-directory: ${{ env.APP_WORKSPACE }}
run: ./mvnw install --no-transfer-progress -Dnative -DskipTests -Dquarkus.native.remote-container-build=true
- name: "Upload native executable"
uses: actions/upload-artifact@v3
with:
name: native-executable
path: ${{ env.APP_WORKSPACE }}/target/*-runner
push-image-native:
runs-on: ubuntu-latest
needs:
- setup
- build-native
name: "Push Native Image to Image Registry"
steps:
- name: "Checkout the code"
uses: actions/checkout@v3
- name: "Download the native executable"
uses: actions/download-artifact@v3
with:
name: native-executable
path: ${{ env.APP_WORKSPACE }}/target
- name: "Login to Image Registry"
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_REPO_USERNAME }}
password: ${{ secrets.QUAY_REPO_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v4
with:
push: true
context: ${{ env.APP_WORKSPACE }}
file: ${{ env.APP_WORKSPACE }}/src/main/docker/Dockerfile.native
# Hack for pseudo ternary expression: If no tag => Latest, if not, tag value
# Source: https://github.com/orgs/community/discussions/25725#discussioncomment-3248924
tags: ${{ env.IMAGE_BASE_NAME }}:${{ needs.setup.outputs.tag_version || needs.setup.outputs.app_version }}-native