Skip to content

Commit

Permalink
Merge pull request #1544 from rjhancock/windows-ci-fix
Browse files Browse the repository at this point in the history
Windows Related CI Fixes
  • Loading branch information
IllianiCBT authored Jul 5, 2024
2 parents cd1e5ba + 5152463 commit 13ebef9
Show file tree
Hide file tree
Showing 17 changed files with 200 additions and 267 deletions.
43 changes: 0 additions & 43 deletions .github/build-scan-init.gradle

This file was deleted.

11 changes: 5 additions & 6 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ coverage:
status:
project:
default:
target: auto # auto compares coverage to the previous base commit
threshold: 1% # the leniency in hitting the target
informational: true # makes project checks informational only, not failing
target: auto
threshold: 1%
informational: true

patch:
default:
informational: true # makes patch checks informational only, not failing
informational: true

fixes:
- "megameklab/::" # reduce root e.g., "before/path/" => "path/"
- "megameklab/::"

ignore:
- "megamek"

github_checks:
# https://docs.codecov.io/docs/github-checks-beta#disabling-github-checks-patch-annotations-via-yaml
annotations: false
44 changes: 6 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
# Builds MegaMekLab for CI (and CD via artifacts)
#
# Jobs:
# - ci_cd: Build MegaMekLab for CI/CD on the specified Operating Systems for the specified Java versions
# - This job will use the MM source directly for the build.
name: MegaMekLab 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 MegaMekLab any time a pull request is added or updated.
ci_cd:
runs-on: ${{ matrix.os }}

outputs:
mmRepo: ${{ steps.find_mm.outputs.mmRepo }}
mmBranch: ${{ steps.find_mm.outputs.mmBranch }}

# Run this job once for each combination in the matrix below.
strategy:
matrix:
os: [ubuntu-latest] # For CI/CD running on *nix is sufficient
Expand All @@ -33,32 +23,14 @@ jobs:
fail-fast: false

steps:
# Checkout the Pull Request source and put it in: ./megameklab
- name: Checking out 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
# Find the repo and branch to use for MM
#
# Output variables:
#
# - mmRepo: The MM repository to use.
# - mmBranch: The MM branch to use.
- name: Find the Right MegaMek Branch
id: find_mm
# Override bash so that it doesn't fail fast (the default) if we can't find the branch
shell: bash {0}
# This shell script searches the PR submitter's MM repo for
# a branch that has the same name as the current PR branch.
# If found it sets the `mmRepo` and `mmBranch` step output variables
# to that branch.
run: |
git ls-remote --exit-code --heads ${{ github.event.pull_request.head.repo.owner.html_url }}/megamek.git ${{ github.event.pull_request.head.ref }}
if [ "$?" == "0" ]
Expand All @@ -71,15 +43,13 @@ jobs:
fi
exit 0
# Checkout the latest MegaMek source and put it in: ./megamek
- name: Checkout MegaMek
uses: actions/checkout@v4
with:
repository: ${{ steps.find_mm.outputs.mmRepo }}
ref: ${{ steps.find_mm.outputs.mmBranch }}
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:
Expand All @@ -88,39 +58,37 @@ jobs:

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- 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

# 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: mml-release-win-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megameklab/megameklab/build/distributions/*.zip
path: ./megameklab/megameklab/build/distributions/megameklab-windows-*.zip

# Put the non-Windows release in an artifact
- name: Upload Nix/Mac Release
uses: actions/upload-artifact@v4
with:
name: mml-release-nix-mac-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megameklab/megameklab/build/distributions/*.tar.gz
path: ./megameklab/megameklab/build/distributions/megameklab-unix-*.tar.gz
25 changes: 1 addition & 24 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,33 @@
# 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
os: [ubuntu-latest]
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:
Expand All @@ -60,17 +41,13 @@ jobs:
working-directory: megameklab
run: ./gradlew test

# 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:
Expand Down
37 changes: 1 addition & 36 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
name: "CodeQL"

on:
Expand All @@ -27,10 +17,9 @@ jobs:
mmRepo: ${{ steps.find_mm.outputs.mmRepo }}
mmBranch: ${{ steps.find_mm.outputs.mmBranch }}

# Run this job once for each combination in the matrix below.
strategy:
matrix:
os: [ubuntu-latest] # For Code QL running on *nix is sufficient
os: [ubuntu-latest]
language: ["java"]
java-distribution: [temurin]
java-version: [17]
Expand All @@ -42,26 +31,9 @@ jobs:
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
# Find the repo and branch to use for MM
#
# Output variables:
#
# - mmRepo: The MM repository to use.
# - mmBranch: The MM branch to use.
- name: Find the Right MegaMek Branch
id: find_mm
# Override bash so that it doesn't fail fast (the default) if we can't find the branch
shell: bash {0}
# This shell script searches the PR submitter's MM repo for
# a branch that has the same name as the current PR branch.
# If found it sets the `mmRepo` and `mmBranch` step output variables
# to that branch.
run: |
git ls-remote --exit-code --heads ${{ github.event.pull_request.head.repo.owner.html_url }}/megamek.git ${{ github.event.pull_request.head.ref }}
if [ "$?" == "0" ]
Expand All @@ -74,30 +46,23 @@ jobs:
fi
exit 0
# Checkout the latest MegaMek source and put it in: ./megamek
- name: Checkout MegaMek
uses: actions/checkout@v4
with:
repository: ${{ steps.find_mm.outputs.mmRepo }}
ref: ${{ steps.find_mm.outputs.mmBranch }}
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 }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
queries: +security-and-quality

- name: Setup Gradle
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/dependency-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Gradle Dependency Submission

on:
push:
branches:
- main

jobs:
dependency-submission:
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4

- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"
Loading

0 comments on commit 13ebef9

Please sign in to comment.