Skip to content

(More) Ammo techbase fixes #2998

(More) Ammo techbase fixes

(More) Ammo techbase fixes #2998

Workflow file for this run

# Builds MegaMek for CI (and CD via artifacts)
#
# Jobs:
# - ci_cd: Build MegaMek for CI/CD on the specified Operating Systems for the specified Java versions
name: MegaMek CI with Gradle
# This Action Definition should be triggered only on
# Pull Requests being added/updated against master.
on:
pull_request:
branches: [ master ]
# Setup the Build Scan "VCS" link for all gradle invocations
env:
GRADLE_OPTS: "-Dscan.link.VCS=${{ github.event.pull_request.html_url }}"
jobs:
# Perform CI (and CD as an artifact) of MegaMek any time a pull request is added or updated.
ci_cd:
runs-on: ${{ matrix.os }}
# Run this job once for each combination in the matrix below.
strategy:
matrix:
os: [ ubuntu-latest ] # For CI/CD running on *nix is sufficient
java-distribution: [ temurin ]
java-version: [ 11, 17 ]
fail-fast: false
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
# If we have a buildScanUri comment on the PR
#
# NB: This only works if you're on the main MegaMek\megamek repo
# for now due to a GitHub Actions limitation.
# CAW: temporarily halted https://github.com/thollander/actions-comment-pull-request/issues/17
# - name: Comment on PR with Build Scan URI
# uses: thollander/actions-comment-pull-request@master
# if: always() && steps.gradle_build.outputs.buildScanUri != ''
# with:
# message: Build scan available at ${{ steps.gradle_build.outputs.buildScanUri }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 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@v3
with:
name: mm-release-win-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/megamek-windows-*.zip
# Put the non-Windows release in an artifact
- name: Upload Nix/Mac Release
uses: actions/upload-artifact@v3
with:
name: mm-release-nix-mac-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/*.tar