-
Notifications
You must be signed in to change notification settings - Fork 291
78 lines (68 loc) · 2.42 KB
/
code-coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# 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