Skip to content

Merge pull request #1515 from rjhancock/java-17 #4

Merge pull request #1515 from rjhancock/java-17

Merge pull request #1515 from rjhancock/java-17 #4

Workflow file for this run

# Builds MegaMekLab for Code Coverage
#
# Jobs:
# - code_coverage: Build MegaMekLab on the specified Operating Systems for the specified Java versions
# and upload the code coverage results to CodeCov.io
# - This job will use MM source directly for the build.
name: MegaMekLab CI with Code Coverage
# This Action Definition should be triggered only on pushes to master
on:
push:
branches: [master]
# 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:
# Perform build of MegaMekLab for Code Coverage any time master updated.
code_coverage:
runs-on: ${{ matrix.os }}
# Run this job once for each combination in the matrix below.
strategy:
matrix:
os: [ubuntu-latest] # For Code QL running on *nix is sufficient
java-distribution: [temurin]
java-version: [17]
steps:
# Checkout the Pull Request 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 }}
# Make sure we can execute the Gradle wrapper
- 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 build --stacktrace --scan
# If the build step fails, try to upload any test logs in case it was a unit test failure.
#
# The logs will be relative to the ./megameklab directory.
- name: Upload Test Logs on Failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cd-failure-logs
path: ./megameklab/megameklab/build/reports/
# Upload our Code Coverage Reports to CodeCov.io
- name: CodeCov.io Coverage Report
uses: codecov/codecov-action@v4
with:
directory: ./megameklab/megameklab/build/reports/jacoco/test
fail_ci_if_error: false
verbose: true