Skip to content

.github/workflows/gradle.yml #553

.github/workflows/gradle.yml

.github/workflows/gradle.yml #553

Workflow file for this run

on: [push, pull_request, create]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
jdk: [11]
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 9
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.jdk }}
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Execute tests
run: ./gradlew check
- name: Assemble fat jar
run: ./gradlew shadowJar
- name: Upload jars as artifact
uses: actions/upload-artifact@v4
with:
name: software-challenge-gui-${{ github.sha }}-{{ runner.os }}
path: build/*.jar
build-arm:
runs-on: ${{ matrix.os }}
#if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os: [macos-latest-large]
jdk: [11]
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 2
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.jdk }}
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Assemble fat jar
run: ./gradlew shadowJar
- name: Upload jars as artifact
uses: actions/upload-artifact@v4
with:
name: software-challenge-gui-${{ github.sha }}-{{ runner.os }}
path: build/*.jar
release:
needs: [build, build-arm]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4 # https://github.com/actions/download-artifact
with:
pattern: software-challenge-gui-${{ github.sha }}-*
path: build
merge-multiple: true
- name: Release ${{ github.ref }}
uses: softprops/action-gh-release@v1 # https://github.com/softprops/action-gh-release
with:
files: build/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}