Skip to content

Merge pull request #4725 from Saklad5/atm-ammo #18

Merge pull request #4725 from Saklad5/atm-ammo

Merge pull request #4725 from Saklad5/atm-ammo #18

Workflow file for this run

# Builds MegaMek for Code Coverage
#
# Jobs:
# - code_coverage: Build MegaMek on the specified Operating Systems for the specified Java versions
# and upload the code coverage results to CodeCov.io
name: MegaMek 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/megamek/commit/${{ github.sha }}"
jobs:
# Perform build of MegaMek 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: ./megamek
- uses: actions/checkout@v3
with:
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@v3
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: megamek
run: chmod +x gradlew
if: runner.os != 'Windows'
# Build the MegaMek project
#
# Directory layout:
# /megamek
# /gradlew
#
# Output Variables:
# - buildScanUri
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build --stacktrace --scan
build-root-directory: megamek
# 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 ./megamek directory.
- name: Upload Test Logs on Failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: cd-failure-logs
path: ./megamek/megamek/build/reports/
# Upload our Code Coverage Reports to CodeCov.io
- name: CodeCov.io Coverage Report
uses: codecov/codecov-action@v3
with:
directory: ./megamek/megamek/build/reports/jacoco/test
fail_ci_if_error: false
verbose: true