[bgw-gui] Migrate Backend from JavaFX to JCEF with Kotlin/JS #642
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: Analyze, Build and Deploy | |
on: | |
pull_request: | |
push: | |
workflow_dispatch: | |
env: | |
JDK_VERSION: 11 | |
jobs: | |
safety-check: | |
name: Check for modified Gradle | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Validate Gradle artifacts | |
uses: gradle/wrapper-validation-action@v1 | |
detekt: | |
name: Generate Detekt report | |
needs: safety-check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required for version number generation | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JDK_VERSION }} | |
- name: Run Detekt | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: detekt | |
- name: Collect results | |
shell: sh | |
run: > | |
mkdir sarif && | |
find * -name detekt.sarif -print0 | | |
xargs -n1 -0 bash -c 'cp "$1" "sarif/${1//\//-}"' '{}' | |
- name: Upload analysis results | |
uses: github/codeql-action/upload-sarif@v1 | |
with: | |
sarif_file: sarif | |
wait-for-processing: true | |
kover: | |
name: Generate Kover report | |
needs: safety-check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required for version number generation | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JDK_VERSION }} | |
- name: Run Kover | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: koverReport koverMergedReport | |
- name: Upload analysis results | |
uses: codecov/codecov-action@v2 | |
with: | |
directory: 'build/reports/kover' | |
fail_ci_if_error: true | |
verbose: true | |
junit-test: | |
name: Run JUnit tests | |
needs: safety-check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required for version number generation | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JDK_VERSION }} | |
- name: Run tests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: test | |
- name: Upload test results | |
uses: mikepenz/action-junit-report@v2 | |
if: always() # Must execute after failed tests | |
with: | |
report_paths: '**/build/test-results/test/TEST-*.xml' | |
platform-test: | |
name: Run JUnit tests on ${{ matrix.os }} | |
needs: junit-test | |
strategy: | |
matrix: | |
os: [ macos-latest, windows-latest ] # Ubuntu is tested in "test" job | |
fail-fast: false # Ensure we get all failures on other platforms | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required for version number generation | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JDK_VERSION }} | |
- name: Run tests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: test | |
spotless: | |
name: Run Spotless | |
needs: safety-check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Initial Setup | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required for version number generation & diff generation | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JDK_VERSION }} | |
- name: Run Spotless checks | |
id: spotlessCheck | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: spotlessCheck | |
- name: Apply Spotless fixes | |
if: failure() | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: spotlessApply | |
- name: Generate diff | |
if: failure() | |
shell: sh | |
run: | | |
echo "# Spotless violations" >> $GITHUB_STEP_SUMMARY | |
echo "```diff" >> $GITHUB_STEP_SUMMARY | |
git diff >> $GITHUB_STEP_SUMMARY | |
echo "```" >> $GITHUB_STEP_SUMMARY | |
publish-maven: | |
name: Publish to Maven Central | |
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' }} | |
needs: [ spotless, platform-test ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required for version number generation | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JDK_VERSION }} | |
- name: Import GPG key | |
id: importGPG | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
- name: Publish artifacts on Maven Central | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: | | |
-Psigning.keyId=${{ steps.importGPG.outputs.keyid }} | |
-PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} | |
-PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} | |
publishToSonatype | |
closeSonatypeStagingRepository | |
- name: Get the build version | |
shell: sh | |
run: | | |
echo "GRADLE_PROJECT_VERSION=$(./gradlew --quiet --console=plain :version)" >> $GITHUB_ENV | |
- name: Create issue for finalizing release | |
if: ${{ !endsWith(env.GRADLE_PROJECT_VERSION, '-SNAPSHOT') }} | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
filename: contrib/release-staging.md | |
publish-docker: | |
name: Publish to Docker Hub | |
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'main' }} | |
needs: [ spotless, platform-test ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required for version number generation | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JDK_VERSION }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Publish artifacts on Docker Hub | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: buildBootImage |