Skip to content

Merge branch 'develop' of https://github.com/olepoeschl/NQueensFAF in… #404

Merge branch 'develop' of https://github.com/olepoeschl/NQueensFAF in…

Merge branch 'develop' of https://github.com/olepoeschl/NQueensFAF in… #404

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://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Build
on:
workflow_dispatch:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
jobs:
build-jar:
if: |
contains(github.event_name, 'workflow_dispatch') ||
contains(github.event.head_commit.message, '[trigger-nightly-build]')
runs-on: ubuntu-latest
permissions: write-all
outputs:
project-version: ${{ steps.bump-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package
- name: Extract Maven project version
run: echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
id: bump-version
- name: Rename artifact core to contain "nightly"
run: mv nqueensfaf-core/target/nqueensfaf-core-${{ steps.bump-version.outputs.version }}.jar nqueensfaf-core/target/nqueensfaf-core-${{ steps.bump-version.outputs.version }}-nightly.jar
- name: Rename artifact impl to contain "nightly"
run: mv nqueensfaf-impl/target/nqueensfaf-impl-${{ steps.bump-version.outputs.version }}.jar nqueensfaf-impl/target/nqueensfaf-impl-${{ steps.bump-version.outputs.version }}-nightly.jar
- name: Delete old nightly Release if there is one, create new nightly Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if $(gh release list | grep -q -e "nightly"); then
gh release delete "nightly" -y --cleanup-tag
fi
gh release create "nightly" \
nqueensfaf-core/target/nqueensfaf-core-${{ steps.bump-version.outputs.version }}-nightly.jar \
nqueensfaf-impl/target/nqueensfaf-impl-${{ steps.bump-version.outputs.version }}-nightly.jar \
-t "Latest Nightly Build" -p --generate-notes
- name: Submit Dependency Snapshot
uses: advanced-security/maven-dependency-submission-action@v4
build-linux:
runs-on: ubuntu-latest
needs: build-jar
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package
- name: Extract lwjgl native shared library
run: |
cd nqueensfaf-demo/target
7z e nqueensfaf-demo-${{ needs.build-jar.outputs.project-version }}.jar linux/x64/org/lwjgl/liblwjgl.so
- name: Upload shared library
uses: actions/upload-artifact@v4
with:
name: lwjgl-linux-native
path: nqueensfaf-demo/target/liblwjgl.so
retention-days: 1
build-macos:
runs-on: macos-latest
needs: build-jar
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package
- name: Extract lwjgl native shared library
run: |
cd nqueensfaf-demo/target
7z e nqueensfaf-demo-${{ needs.build-jar.outputs.project-version }}.jar macos/arm64/org/lwjgl/liblwjgl.dylib
- name: Upload shared library
uses: actions/upload-artifact@v4
with:
name: lwjgl-macos-native
path: nqueensfaf-demo/target/liblwjgl.dylib
retention-days: 1
build-windows:
runs-on: windows-latest
needs: build-jar
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package
- name: Extract lwjgl native shared library
run: |
cd nqueensfaf-demo/target
7z e nqueensfaf-demo-${{ needs.build-jar.outputs.project-version }}.jar windows/x64/org/lwjgl/lwjgl.dll
- name: Upload shared library
uses: actions/upload-artifact@v4
with:
name: lwjgl-windows-native
path: nqueensfaf-demo/target/lwjgl.dll
retention-days: 1
build-demo:
runs-on: ubuntu-latest
needs: [build-jar, build-linux, build-macos, build-windows]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package
- name: Download lwjgl natives
uses: actions/download-artifact@v4
- name: Inject lwjgl natives into runnable jar
run: |
mkdir -p nqueensfaf-demo/target/macos/x64/org/lwjgl
mkdir -p nqueensfaf-demo/target/windows/x64/org/lwjgl
mv lwjgl-macos-native/liblwjgl.dylib nqueensfaf-demo/target/macos/x64/org/lwjgl
mv lwjgl-windows-native/lwjgl.dll nqueensfaf-demo/target/windows/x64/org/lwjgl
cd nqueensfaf-demo/target
7z a nqueensfaf-demo-${{ needs.build-jar.outputs.project-version }}.jar macos windows
- name: Rename artifact to contain "nightly"
run: mv nqueensfaf-demo/target/nqueensfaf-demo-${{ needs.build-jar.outputs.project-version }}.jar nqueensfaf-demo/target/nqueensfaf-demo-${{ needs.build-jar.outputs.project-version }}-nightly.jar
- name: Upload artifact to nightly release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "nightly" nqueensfaf-demo/target/nqueensfaf-demo-${{ needs.build-jar.outputs.project-version }}-nightly.jar --clobber