Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
srozange committed Aug 15, 2023
0 parents commit 8858561
Show file tree
Hide file tree
Showing 18 changed files with 1,516 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*
116 changes: 116 additions & 0 deletions .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: EarlyAccess

on:
workflow_dispatch:

env:
GRAAL_VERSION: '22.3.0'
JAVA_VERSION: '17'
JAVA_DISTRO: 'zulu'

jobs:
precheck:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.vars.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: Version
id: vars
shell: bash
run: |
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$(echo $version)" >>$GITHUB_OUTPUT
# Build native executable per runner
build:
needs: [ precheck ]
if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT')
name: 'Build with Graal on ${{ matrix.os }}'
strategy:
fail-fast: true
matrix:
os: [ ubuntu-20.04, macOS-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: 'Check out repository'
uses: actions/checkout@v3

- name: 'Set up Graal'
uses: graalvm/setup-graalvm@v1
with:
version: ${{ env.GRAAL_VERSION }}
java-version: ${{ env.JAVA_VERSION }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: 'Cache Maven packages'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: 'Build Native Image'
run: ./mvnw -B -ntp --file pom.xml -Pnative package

- name: 'Create distribution'
run: ./mvnw -B -ntp --file pom.xml -Pdist package -DskipTests

- name: 'Upload build artifact'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
target/distributions/*.zip
target/distributions/*.tar.gz
# Collect all executables and release
release:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: 'Check out repository'
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 'Download all build artifacts'
uses: actions/download-artifact@v3

- name: 'Set up Java'
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- name: 'Cache Maven packages'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: 'Release with JReleaser'
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./mvnw -B -ntp --file pom.xml -Prelease -DartifactsDir=artifacts jreleaser:full-release
33 changes: 33 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build

on: push

env:
GRAAL_VERSION: '22.3.0'
JAVA_VERSION: '17'
JAVA_DISTRO: 'zulu'

jobs:
build:
if: startsWith(github.event.head_commit.message, '🏁 Releasing version') != true && startsWith(github.event.head_commit.message, '⬆️ Next version') != true
runs-on: ubuntu-latest

steps:
- name: 'Check out repository'
uses: actions/checkout@v3

- name: 'Set up Java'
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- name: 'Cache Maven packages'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: 'Build'
run: ./mvnw -B -ntp --file pom.xml verify
142 changes: 142 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: "Release version"
required: true
next:
description: "Next version"
required: false

env:
GRAAL_VERSION: '22.3.0'
JAVA_VERSION: '17'
JAVA_DISTRO: 'zulu'

jobs:
precheck:
runs-on: ubuntu-latest
outputs:
HEAD: ${{ steps.version.outputs.HEAD }}
NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }}
steps:
- uses: actions/checkout@v3

- name: 'Set up Java'
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- name: 'Cache Maven packages'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: 'Set release version'
id: version
run: |
RELEASE_VERSION=${{ github.event.inputs.version }}
NEXT_VERSION=${{ github.event.inputs.next }}
PLAIN_VERSION=`echo ${RELEASE_VERSION} | awk 'match($0, /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)/) { print substr($0, RSTART, RLENGTH); }'`
COMPUTED_NEXT_VERSION="${PLAIN_VERSION}-SNAPSHOT"
if [ -z $NEXT_VERSION ]
then
NEXT_VERSION=$COMPUTED_NEXT_VERSION
fi
./mvnw -B -ntp -ntp versions:set versions:commit -DnewVersion=$RELEASE_VERSION
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -a -m "🏁 Releasing version $RELEASE_VERSION"
git push origin HEAD:main
HEAD=`git rev-parse HEAD`
echo "NEXT_VERSION=$(echo $NEXT_VERSION)" >>$GITHUB_OUTPUT
echo "HEAD=$(echo $HEAD)" >>$GITHUB_OUTPUT
# Build native executable per runner
build:
needs: [ precheck ]
name: 'Build with Graal on ${{ matrix.os }}'
strategy:
fail-fast: true
matrix:
os: [ ubuntu-20.04, macOS-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: 'Check out repository'
uses: actions/checkout@v3
with:
ref: ${{ needs.precheck.outputs.HEAD }}

- name: 'Set up Graal'
uses: graalvm/setup-graalvm@v1
with:
version: ${{ env.GRAAL_VERSION }}
java-version: ${{ env.JAVA_VERSION }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: 'Cache Maven packages'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: 'Build Native Image'
run: ./mvnw -B -ntp --file pom.xml -Pnative package

- name: 'Create distribution'
run: ./mvnw -B -ntp --file pom.xml -Pdist package -DskipTests

- name: 'Upload build artifact'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
target/distributions/*.zip
target/distributions/*.tar.gz
# Collect all executables and release
release:
needs: [ precheck, build ]
runs-on: ubuntu-latest
steps:
- name: 'Check out repository'
uses: actions/checkout@v3
with:
ref: ${{ needs.precheck.outputs.HEAD }}
fetch-depth: 0

- name: 'Download all build artifacts'
uses: actions/download-artifact@v3

- name: 'Set up Java'
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- name: 'Cache Maven packages'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: 'Release with JReleaser'
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./mvnw -B -ntp --file pom.xml -Prelease -DartifactsDir=artifacts jreleaser:full-release

- name: 'Set next version'
run: |
./mvnw -B -ntp versions:set versions:commit -DnewVersion=${{ needs.precheck.outputs.NEXT_VERSION }}
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -a -m "⬆️ Next version $NEXT_VERSION"
git push origin HEAD:main
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties

# Eclipse
.project
.classpath
.settings/
bin/

# IntelliJ
.idea
*.ipr
*.iml
*.iws

# NetBeans
nb-configuration.xml

# Visual Studio Code
.vscode
.factorypath

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
*.orig
*.rej

# Local environment
.env
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
Loading

0 comments on commit 8858561

Please sign in to comment.