Skip to content

fix platform params #52

fix platform params

fix platform params #52

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
tags:
- 'v*'
jobs:
build-jar-job:
name: 'Build Runnable JAR'
runs-on: ubuntu-latest
steps:
- name: checkout from git
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- id: build_jar
name: Build JARs
env:
OPENEPCIS_OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OPENEPCIS_OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: |
mvn \
-s .mvn/settings.xml \
--no-transfer-progress \
--batch-mode -Pcli-build \
clean package
- name: 'Get Version Number'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
echo "::set-env name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
- name: 'Publish CLI JAR'
uses: actions/upload-artifact@v3
with:
name: 'openepcis-event-hash-generator-cli-${{env.VERSION}}-jar-with-dependencies.jar'
path: 'cli/target/openepcis-event-hash-generator-cli-${{env.VERSION}}-jar-with-dependencies.jar'
- name: 'Create Release'
if: contains(github.ref, 'v')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{github.ref}}
release_name: Release ${{github.ref}}
body: |
Initial release
draft: false
prerelease: false
- name: 'Upload Release Service Asset'
if: contains(github.ref, 'v')
id: upload-service-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: 'quarkus-app/target/openepcis-event-hash-generator-service.jar'
asset_name: 'openepcis-event-hash-generator-service.jar'
asset_content_type: application/java-archive
- name: 'Upload Release CLI Asset'
if: contains(github.ref, 'v')
id: upload--cli-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: 'cli/target/openepcis-event-hash-generator-cli-${{env.VERSION}}-jar-with-dependencies.jar'
asset_name: 'openepcis-event-hash-generator-cli.jar'
asset_content_type: application/java-archive
- name: 'Write Upload URL To File'
if: contains(github.ref, 'v')
run: |
echo "${{steps.create_release.outputs.upload_url}}" > upload_url.txt
- name: 'Publish Upload URL'
if: contains(github.ref, 'v')
uses: actions/upload-artifact@v3
with:
name: 'upload_url.txt'
path: 'upload_url.txt'
build-quarkus-native-container-images:
name: "Build Native Container Images"
runs-on: ubuntu-latest
steps:
- name: checkout from git
uses: actions/checkout@v3
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Set up Docker Buildx
id: builder
uses: docker/setup-buildx-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: "Prepare Build"
run: >
mvn --no-transfer-progress --batch-mode -Pci-build clean package
- name: "Build amd64 native Image"
run: |
mvn --no-transfer-progress --batch-mode -Pci-build package -Dnative -f ./quarkus-app/pom.xml \
-Dquarkus.native.container-build=true \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.name=event-hash-generator-service-native \
-Dquarkus.container-image.registry=ghcr.io \
-Dquarkus.container-image.group=openepcis \
-Dquarkus.container-image.additional-tags=latest-amd64 \
-Dquarkus.native.container-runtime-options="--platform=linux/amd64" \
-Dquarkus.jib.platforms=linux/amd64
- name: "Build arm64 native Image"
run: |
mvn --no-transfer-progress --batch-mode -Pci-build package -Dnative -f ./quarkus-app/pom.xml \
-Dquarkus.native.container-build=true \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.name=event-hash-generator-service-native \
-Dquarkus.container-image.registry=ghcr.io \
-Dquarkus.container-image.group=openepcis \
-Dquarkus.container-image.additional-tags=latest-arm64 \
-Dquarkus.native.container-runtime-options="--platform=linux/arm64" \
-Dquarkus.jib.platforms=linux/arm64/v8
- name: "push arch image"
run: |
docker push ghcr.io/openepcis/event-hash-generator-service-native:latest-amd64;
docker push ghcr.io/openepcis/event-hash-generator-service-native:latest-arm64;
export DOCKER_CLI_EXPERIMENTAL=enabled;
docker manifest create ghcr.io/openepcis/event-hash-generator-service-native:latest \
--amend ghcr.io/openepcis/event-hash-generator-service-native:latest-amd64 \
--amend ghcr.io/openepcis/event-hash-generator-service-native:latest-arm64;
docker manifest push ghcr.io/openepcis/event-hash-generator-service-native:latest;
build-quarkus-container-images:
name: "Build Container Images"
runs-on: 'ubuntu-latest'
steps:
- name: checkout from git
uses: actions/checkout@v3
- name: docker hub
uses: docker/login-action@v1
with:
username: ${{ secrets.OPENEPCIS_DOCKER_USER }}
password: ${{ secrets.OPENEPCIS_DOCKER_TOKEN }}
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: builder
uses: docker/setup-buildx-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: "Prepare Build"
run: >
mvn --no-transfer-progress --batch-mode -Pci-build clean package
- name: "Build linux/amd64 Image"
run: |
mvn --no-transfer-progress --batch-mode \
clean package -Pci-build -f ./quarkus-app/pom.xml \
-Dquarkus.container-image.name=event-hash-generator-service \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.registry=ghcr.io \
-Dquarkus.container-image.group=openepcis \
-Dquarkus.jib.base-jvm-image=eclipse-temurin:17-jre-ubi9-minimal \
-Dquarkus.container-image.additional-tags=latest-amd64 \
-Dquarkus.jib.platforms=linux/amd64
- name: "Build linux/arm64 Image"
run: |
mvn --no-transfer-progress --batch-mode \
clean package -Pci-build -f ./quarkus-app/pom.xml \
-Dquarkus.container-image.name=event-hash-generator-service \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.registry=ghcr.io \
-Dquarkus.container-image.group=openepcis \
-Dquarkus.jib.base-jvm-image=eclipse-temurin:17-jre-ubi9-minimal \
-Dquarkus.container-image.additional-tags=latest-arm64 \
-Dquarkus.jib.platforms=linux/arm64/v8
- name: "push multi arch image"
run: |
docker push ghcr.io/openepcis/event-hash-generator-service:latest-amd64;
docker push ghcr.io/openepcis/event-hash-generator-service:latest-arm64;
export DOCKER_CLI_EXPERIMENTAL=enabled;
docker manifest create ghcr.io/openepcis/event-hash-generator-service:latest \
--amend ghcr.io/openepcis/event-hash-generator-service:latest-amd64 \
--amend ghcr.io/openepcis/event-hash-generator-service:latest-arm64;
docker manifest push ghcr.io/openepcis/event-hash-generator-service:latest;
build-quarkus-native-executable:
name: "Build Quarkus Service Native Executable"
needs: [build-jar-job]
strategy:
matrix:
os: ['ubuntu-latest', 'ubuntu-22.04-arm64', 'macos-latest', 'windows-latest']
include:
- os: 'ubuntu-latest'
label: 'linux-amd64'
exe: ""
- os: 'ubuntu-22.04-arm64'
label: 'linux-arm64'
exe: ""
- os: 'macos-latest'
label: 'mac'
exe: ""
- os: 'windows-latest'
label: 'windows'
exe: ".exe"
runs-on: ${{matrix.os}}
steps:
- name: checkout from git
uses: actions/checkout@v3
- name: 'Download Release URL'
if: contains(github.ref, 'v')
uses: actions/download-artifact@v3
with:
name: 'upload_url.txt'
- name: 'Set Upload URL Env Var'
if: contains(github.ref, 'v')
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
echo "::set-env name=UPLOAD_URL::$(cat upload_url.txt)"
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm-community'
native-image-job-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: "Prepare Build"
run: |
mvn --no-transfer-progress --batch-mode -Pci-build clean package
- name: "Build Native Quarkus Executable"
run: |
mvn --no-transfer-progress --batch-mode clean package -Pnative -Pci-build -f ./quarkus-app/pom.xml
- name: 'Release Native Quarkus Executable'
if: success() && contains(github.ref, 'v')
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{env.UPLOAD_URL}}
asset_name: 'openepcis-event-hash-generator-service-runner-${{matrix.label}}${{matrix.exe}}'
asset_path: 'quarkus-app/target/openepcis-event-hash-generator-service-runner${{matrix.exe}}'
asset_content_type: application/octet-stream
build-cli-native-executable:
name: 'Build CLI Native Executable'
needs: [build-jar-job]
strategy:
matrix:
os: ['ubuntu-latest', 'ubuntu-22.04-arm64', 'macos-latest', 'windows-latest']
include:
- os: 'ubuntu-latest'
label: 'linux-amd64'
exe: ""
- os: 'ubuntu-22.04-arm64'
label: 'linux-arm64'
exe: ""
- os: 'macos-latest'
label: 'mac'
exe: ""
- os: 'windows-latest'
label: 'windows'
exe: ".exe"
runs-on: ${{matrix.os}}
steps:
- name: checkout from git
uses: actions/checkout@v3
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm-community'
native-image-job-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Get Version Number'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
echo "::set-env name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
shell: bash
- name: 'Get JAR Artifact'
uses: actions/download-artifact@v3
with:
name: 'openepcis-event-hash-generator-cli-${{env.VERSION}}-jar-with-dependencies.jar'
- name: 'Download Release URL'
if: contains(github.ref, 'v')
uses: actions/download-artifact@v3
with:
name: 'upload_url.txt'
- name: 'Set Upload URL Env Var'
if: contains(github.ref, 'v')
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
echo "::set-env name=UPLOAD_URL::$(cat upload_url.txt)"
- name: 'Build Native CLI Image'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
native-image --no-server --no-fallback --enable-http --enable-https --allow-incomplete-classpath -H:+JNI -H:+UseServiceLoaderFeature -H:ReflectionConfigurationFiles=./cli/src/native/resources/reflect.json -jar openepcis-event-hash-generator-cli-${{env.VERSION}}-jar-with-dependencies.jar
- name: 'Publish Native CLI Image'
if: success()
uses: actions/upload-artifact@v3
with:
name: 'openepcis-event-hash-generator-cli-${{env.VERSION}}-${{matrix.label}}${{matrix.exe}}'
path: 'openepcis-event-hash-generator-cli-${{env.VERSION}}-jar-with-dependencies${{matrix.exe}}'
- name: 'Release Native Image Asset'
if: success() && contains(github.ref, 'v')
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{env.UPLOAD_URL}}
asset_name: 'openepcis-event-hash-generator-cli-${{matrix.label}}${{matrix.exe}}'
asset_path: 'openepcis-event-hash-generator-cli-${{env.VERSION}}-jar-with-dependencies${{matrix.exe}}'
asset_content_type: application/octet-stream