Skip to content

MegaMekLab Nightly CI #1540

MegaMekLab Nightly CI

MegaMekLab Nightly CI #1540

Workflow file for this run

# Builds MegaMekLab for CI each Night
#
# Jobs:
# - nightly_ci: Build MegaMekLab for CI across multiple platforms and Java versions.
name: MegaMekLab Nightly CI
on:
schedule:
# Nightly at Midnight (UTC)
# ref: https://crontab.guru/every-night
- cron: "0 0 * * *"
# Setup the Build Scan "VCS" link for all gradle invocations
env:
GRADLE_OPTS: "-Dscan.link.VCS=https://github.com/MegaMek/megameklab/commit/${{ github.sha }}"
jobs:
nightly_ci:
runs-on: ${{ matrix.os }}
# Run this job once for each combination in the matrix below.
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
java-distribution: [temurin]
java-version: [17]
fail-fast: false
name: Nightly MegaMekLab CI ${{ matrix.os }} on ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
steps:
# Checkout the latest source and put it in: ./megameklab
- uses: actions/checkout@v4
with:
path: megameklab
# Setup composite build for MegaMekLab
# See: https://github.com/MegaMek/megamek/wiki/Working-With-Gradle
- name: Setup Composite Build for MegaMekLab
run: |
echo "includeBuild '../megamek'" >./megameklab/settings_local.gradle
# Checkout the latest MegaMek source and put it in: ./megamek
- name: Checkout MegaMek
uses: actions/checkout@v4
with:
repository: MegaMek/megamek
path: megamek
# Setup the requested Java Distribution and Version from the matrix
- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.java-distribution }}
java-version: ${{ matrix.java-version }}
# Don't run this for Windows.
- name: Grant execute permission for gradlew (*nix or MacOS)
working-directory: megameklab
run: chmod +x gradlew
if: runner.os != 'Windows'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
working-directory: megameklab
run: ./gradlew clean build -x test --continue --stacktrace --scan
- name: Upload Test Logs on Failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ matrix.os }}-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}-ci-failure-logs
path: megameklab/megameklab/build/reports/
# Put the non-Windows Release in an artifact
#
# NB: Due to a GitHub Actions limitation we won't know what the filename is in order to display it somewhere.
- name: Upload Nix/Mac Releases
uses: actions/upload-artifact@v4
if: always() && matrix.os == 'ubuntu-latest'
with:
name: mml-release-nix-mac-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: megameklab/megameklab/build/distributions/*.tar.gz
# Put the Windows Release in an artifact
#
# NB: Due to a GitHub Actions limitation we won't know what the filename is in order to display it somewhere.
- name: Upload Windows Release
uses: actions/upload-artifact@v4
if: always() && matrix.os == 'windows-latest'
with:
name: mml-release-win-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: megameklab/megameklab/build/distributions/*.zip