-
Notifications
You must be signed in to change notification settings - Fork 175
129 lines (110 loc) · 4.24 KB
/
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: MekHQ CI with Gradle
on:
pull_request:
branches: [master]
env:
GRADLE_OPTS: "-Dscan.link.VCS=${{ github.event.pull_request.html_url }}"
jobs:
ci_cd:
runs-on: ${{ matrix.os }}
outputs:
mmRepo: ${{ steps.find_mm.outputs.mmRepo }}
mmBranch: ${{ steps.find_mm.outputs.mmBranch }}
mmlRepo: ${{ steps.find_mml.outputs.mmRepo }}
mmlBranch: ${{ steps.find_mml.outputs.mmBranch }}
strategy:
matrix:
os: [ubuntu-latest]
java-distribution: [temurin]
java-version: [17]
fail-fast: false
steps:
- name: Checkout out MekHQ
uses: actions/checkout@v4
with:
path: mekhq
- name: Find the Right MegaMek Branch
id: find_mm
shell: bash {0}
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" ]
then
echo "mmRepo=${{ github.event.pull_request.head.repo.owner.login }}/megamek" >> $GITHUB_OUTPUT
echo "mmBranch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
else
echo "mmRepo=MegaMek/megamek" >> $GITHUB_OUTPUT
echo "mmBranch=master" >> $GITHUB_OUTPUT
fi
exit 0
- name: Add MMRevision file
run: |
echo ${{ steps.find_mm.outputs.mmBranch }} >> mekhq/MekHQ/mm-revision.txt
- name: Checkout MegaMek
uses: actions/checkout@v4
with:
repository: ${{ steps.find_mm.outputs.mmRepo }}
ref: ${{ steps.find_mm.outputs.mmBranch }}
path: megamek
- name: Find the Right MegaMekLab Branch
id: find_mml
shell: bash {0}
run: |
git ls-remote --exit-code --heads ${{ github.event.pull_request.head.repo.owner.html_url }}/megameklab.git ${{ github.event.pull_request.head.ref }}
if [ "$?" == "0" ]
then
echo "mmlRepo=${{ github.event.pull_request.head.repo.owner.login }}/megameklab" >> $GITHUB_OUTPUT
echo "mmlBranch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
else
echo "mmlRepo=MegaMek/megameklab" >> $GITHUB_OUTPUT
echo "mmlBranch=master" >> $GITHUB_OUTPUT
fi
exit 0
- name: Add MMLRevision file
run: |
echo ${{ steps.find_mml.outputs.mmlBranch }} >> mekhq/MekHQ/mml-revision.txt
- name: Checkout MegaMekLab
uses: actions/checkout@v4
with:
repository: ${{ steps.find_mml.outputs.mmlRepo }}
ref: ${{ steps.find_mml.outputs.mmlBranch }}
path: megameklab
- 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 }}
- 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: Add MHQRevision file
run: |
echo ${{ github.sha }} >> mekhq/MekHQ/mhq-revision.txt
- name: Build with Gradle
working-directory: mekhq
run: ./gradlew build --stacktrace --scan
- name: Upload Test Logs on Failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cd-failure-logs
path: ./mekhq/MekHQ/build/reports/
- name: CodeCov.io Coverage Report
uses: codecov/codecov-action@v4
with:
directory: ./mekhq/MekHQ/build/reports/jacoco/test
fail_ci_if_error: false
verbose: true
- name: Upload Tar GZ Artifact
uses: actions/upload-artifact@v4
with:
name: mhq-release-tgz-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: mekhq/MekHQ/build/distributions/*.tar.gz
# - name: Upload Zip Release
# uses: actions/upload-artifact@v4
# with:
# name: mhq-release-zip-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
# path: mekhq/MekHQ/build/distributions/*.zip