Skip to content

Code cleanup (#278) #783

Code cleanup (#278)

Code cleanup (#278) #783

Workflow file for this run

name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
matrix-build:
strategy:
matrix:
java: [21]
os: ['ubuntu-latest', 'windows-latest']
env:
DEFAULT_JAVA: 21
DEFAULT_OS: 'ubuntu-latest'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.java }}
cancel-in-progress: true
name: Build on ${{ matrix.os }} with Java ${{ matrix.java }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v2
- name: Cache SonarQube packages
uses: actions/cache@v4
if: ${{ env.DEFAULT_JAVA == matrix.java && env.DEFAULT_OS == matrix.os }}
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-java-${{ matrix.java }}-sonar
restore-keys: ${{ runner.os }}-java-${{ matrix.java }}-sonar
- name: Build with Gradle using Java ${{ matrix.java }}
run: |
./gradlew build --info --warning-mode=summary -PskipFlakyTests=true -PjavaVersion=${{ matrix.java }}
- name: Archive executable JAR
uses: actions/upload-artifact@v4
if: ${{ env.DEFAULT_JAVA == matrix.java && env.DEFAULT_OS == matrix.os }}
with:
name: executable-jar
path: jfxui/build/libs/white-rabbit-fx-*.jar
if-no-files-found: error
- name: Archive test reports for ${{ matrix.os }} using Java ${{ matrix.java }}
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-reports-${{ matrix.os }}-java-${{ matrix.java }}
path: "**/build/reports/tests/*/**"
if-no-files-found: error
- name: Sonar analysis
if: ${{ env.DEFAULT_JAVA == matrix.java && env.DEFAULT_OS == matrix.os && env.SONAR_TOKEN != null }}
run: |
./gradlew sonarqube -Dsonar.token=$SONAR_TOKEN --info --warning-mode=summary -PjavaVersion=${{ matrix.java }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Build native package for ${{ runner.os }} using Java ${{ matrix.java }}
if: ${{ env.DEFAULT_JAVA == matrix.java }}
run: |
./gradlew jpackage createChecksums --info --warning-mode=summary -PjavaVersion=${{ matrix.java }}
- name: Stop Gradle Daemon
run: |
./gradlew -status
./gradlew -stop
- name: Archive test reports for ${{ runner.os }}
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-reports-${{ runner.os }}
path: "**/build/reports/tests/*/**"
- name: Archive native package for ${{ runner.os }}
uses: actions/upload-artifact@v4
if: ${{ env.DEFAULT_JAVA == matrix.java }}
with:
name: packages-${{ runner.os }}
path: jfxui/build/jpackage-dist/*
- name: Archive checksums for ${{ runner.os }}
uses: actions/upload-artifact@v4
if: ${{ env.DEFAULT_JAVA == matrix.java }}
with:
name: checksums-${{ runner.os }}
path: jfxui/build/generatedChecksums/*
build:
needs: matrix-build
runs-on: ubuntu-latest
steps:
- run: echo "Build successful"