Skip to content

Commit

Permalink
Action Enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
rjhancock committed Jun 30, 2024
1 parent ab96937 commit d8c41d2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 153 deletions.
26 changes: 7 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ jobs:

# 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 ./mekhq directory.
# - name: Upload Test Logs on Failure
# uses: actions/upload-artifact@v3
# if: failure()
# with:
# name: cd-failure-logs
# path: ./mekhq/MekHQ/build/reports/
- name: Upload Test Logs on Failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cd-failure-logs
path: ./mekhq/MekHQ/build/reports/

# Upload our Code Coverage Reports to CodeCov.io
- name: CodeCov.io Coverage Report
Expand All @@ -146,25 +146,13 @@ jobs:
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\mekhq 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@v4
with:
name: mhq-release-win-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./mekhq/MekHQ/build/distributions/mekhq-windows-*.zip
path: ./mekhq/MekHQ/build/distributions/*.zip

# Put the non-Windows release in an artifact
- name: Upload Nix/Mac Release
Expand Down
38 changes: 9 additions & 29 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ jobs:
with:
path: mekhq

# Setup composite build for MekHQ
# See: https://github.com/MegaMek/megamek/wiki/Working-With-Gradle
- name: Setup Composite Build for MekHQ
run: |
echo "includeBuild '../megamek'" >./mekhq/settings_local.gradle
echo "includeBuild '../megameklab'" >>./mekhq/settings_local.gradle
# Checkout the latest MegaMek source and put it in: ./megamek
- name: Checkout MegaMek
uses: actions/checkout@v4
Expand All @@ -55,11 +48,13 @@ jobs:
repository: MegaMek/megameklab
path: megameklab

# Setup composite build for MegaMekLab
# Setup composite build for MekHQ
# See: https://github.com/MegaMek/megamek/wiki/Working-With-Gradle
- name: Setup Composite Build for MegaMekLab
- name: Setup Composite Build for MekHQ
run: |
echo "if (gradle.parent == null) includeBuild '../megamek'" >./megameklab/settings_local.gradle
echo "includeBuild '../megamek'" >> ./mekhq/settings_local.gradle
echo "includeBuild '../megameklab'" >> ./mekhq/settings_local.gradle
echo "includeBuild '../megamek'" >> ./megameklab/settings_local.gradle
# Setup the requested Java Distribution and Version from the matrix
- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
Expand All @@ -68,27 +63,12 @@ jobs:
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: mekhq
run: chmod +x gradlew
if: runner.os != 'Windows'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

# Build the MekHQ project
#
# Directory layout:
# /mekhq
# /gradlew
# /megamek
# /megameklab
#
# Output Variables:
# - buildScanUri
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: clean build --no-build-cache --info --stacktrace --max-workers=1 --scan
build-root-directory: mekhq
working-directory: mekhq
run: ./gradlew test

# If the build step fails, try to upload any test logs in case it was a unit test failure.
#
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: "24 16 * * 4"
Expand Down Expand Up @@ -141,8 +140,8 @@ jobs:
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle
working-directory: mekhq
run: ./gradlew build --stacktrace --scan
working-directory: megameklab
run: ./gradlew jar

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
31 changes: 10 additions & 21 deletions .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ jobs:
with:
path: mekhq

# Setup composite build for MekHQ
# See: https://github.com/MegaMek/megamek/wiki/Working-With-Gradle
- name: Setup Composite Build for MekHQ
run: |
echo "includeBuild '../megamek'" >./mekhq/settings_local.gradle
echo "includeBuild '../megameklab'" >>./mekhq/settings_local.gradle
# Checkout the latest MegaMek source and put it in: ./megamek
- name: Checkout MegaMek
uses: actions/checkout@v4
Expand All @@ -55,11 +48,13 @@ jobs:
repository: MegaMek/megameklab
path: megameklab

# Setup composite build for MegaMekLab
# Setup composite build for MekHQ
# See: https://github.com/MegaMek/megamek/wiki/Working-With-Gradle
- name: Setup Composite Build for MegaMekLab
- name: Setup Composite Build for MekHQ
run: |
echo "if (gradle.parent == null) includeBuild '../megamek'" >./megameklab/settings_local.gradle
echo "includeBuild '../megamek'" >> ./mekhq/settings_local.gradle
echo "includeBuild '../megameklab'" >> ./mekhq/settings_local.gradle
echo "includeBuild '../megamek'" >> ./megameklab/settings_local.gradle
# Setup the requested Java Distribution and Version from the matrix
- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
Expand All @@ -68,18 +63,12 @@ jobs:
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: mekhq
run: chmod +x gradlew
if: runner.os != 'Windows'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

# Include --stacktrace to make some build failures easier to figure out.
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: clean build -x test --continue --stacktrace --max-workers=1 --scan
build-root-directory: mekhq
working-directory: megameklab
run: ./gradlew clean build -x test --continue --stacktrace --scan

- name: Upload Test Logs on Failure
uses: actions/upload-artifact@v4
Expand All @@ -106,4 +95,4 @@ jobs:
if: always() && matrix.os == 'windows-latest'
with:
name: mhq-release-win-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: mekhq/MekHQ/build/distributions/mekhq-windows-*.zip
path: mekhq/MekHQ/build/distributions/*.zip
81 changes: 0 additions & 81 deletions .github/workflows/nightly-maven-ci.yml

This file was deleted.

0 comments on commit d8c41d2

Please sign in to comment.