-
Notifications
You must be signed in to change notification settings - Fork 174
109 lines (93 loc) · 3.81 KB
/
nightly-ci.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Builds MekHQ for CI each Night
#
# Jobs:
# - nightly_ci: Build MekHQ for CI across multiple platforms and Java versions.
name: MekHQ Nightly CI
on:
schedule:
# Nightly at Midnight (UTC)
# ref: https://crontab.guru/every-night
- cron: '0 0 * * *'
# Setup the Build Scan "VCS" link for all gradle invocations
env:
GRADLE_OPTS: "-Dscan.link.VCS=https://github.com/MegaMek/mekhq/commit/${{ github.sha }}"
jobs:
nightly_ci:
runs-on: ${{ matrix.os }}
# Run this job once for each combination in the matrix below.
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
java-distribution: [ temurin ]
java-version: [ 11, 17 ]
fail-fast: false
name: Nightly MekHQ CI ${{ matrix.os }} on ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
steps:
# Checkout the latest source and put it in: ./mekhq
- uses: actions/checkout@v3
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@v3
with:
repository: MegaMek/megamek
path: megamek
# Checkout the latest MegaMekLab source and put it in: ./megameklab
- name: Checkout MegaMekLab
uses: actions/checkout@v3
with:
repository: MegaMek/megameklab
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 "if (gradle.parent == null) 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 }}
uses: actions/setup-java@v3
with:
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'
# Include --stacktrace to make some build failures easier to figure out.
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: clean build -x test --continue --stacktrace --scan
build-root-directory: mekhq
- name: Upload Test Logs on Failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.os }}-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}-ci-failure-logs
path: mekhq/MekHQ/build/reports/
# Put the non-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 Nix/Mac Releases
uses: actions/upload-artifact@v3
if: always() && matrix.os == 'ubuntu-latest'
with:
name: mhq-release-nix-mac-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: mekhq/MekHQ/build/distributions/*.tar
# 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
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