Rename build job #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push Main | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build-jar: | |
name: Build JAR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Cache SonarQube packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Check style | |
run: mvn checkstyle:check | |
- name: Build | |
id: build_jar | |
run: | | |
mvn clean package | |
echo current_version=$(echo $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)) >> $GITHUB_OUTPUT | |
- name: Publish test report | |
if: always() | |
uses: mikepenz/action-junit-report@v5 | |
with: | |
report_paths: '**/target/surefire-reports/TEST-*.xml' | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docsource-jar | |
path: target/docsource.jar | |
- name: Sonar | |
run: mvn verify sonar:sonar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Docker | |
if: endsWith(steps.build_jar.outputs.current_version, '-SNAPSHOT') | |
run: mvn clean package -DskipTests jib:build -Djib.to.auth.username=$DOCKER_USER -Djib.to.auth.password=$DOCKER_TOKEN | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | |
build-native: | |
name: Build Native Image ${{ matrix.platform }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ] | |
include: | |
- os: 'ubuntu-latest' | |
platform: 'linux-amd64' | |
extension: '' | |
- os: 'macos-latest' | |
platform: 'darwin-arm64' | |
extension: '' | |
- os: 'windows-latest' | |
platform: 'windows-amd64' | |
extension: '.exe' | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
distribution: 'graalvm' | |
java-version: '21.0.1' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Check style | |
run: mvn checkstyle:check | |
- name: Build and test | |
run: mvn clean package -Pnative -PnativeTest | |
- name: Version | |
id: native_version | |
run: echo current_version=$(echo $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)) >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Publish native test report | |
if: always() | |
uses: mikepenz/action-junit-report@v5 | |
with: | |
report_paths: '**/target/native-test-reports/TEST-*.xml' | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docsource-${{ matrix.platform }} | |
path: target/docsource${{ matrix.extension }} | |
- name: Docker | |
if: endsWith(steps.native_version.outputs.current_version, '-SNAPSHOT') && matrix.os == 'ubuntu-latest' | |
run: mvn clean package -DskipTests -Pnative jib:build -Djib.to.auth.username=$DOCKER_USER -Djib.to.auth.password=$DOCKER_TOKEN | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} |