-
Notifications
You must be signed in to change notification settings - Fork 9
232 lines (198 loc) · 6.37 KB
/
ci-tests-nightly.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Gradle Tests and Nightly (CI)
env:
GH_PKG_URL: "https://maven.pkg.github.com/${{ github.repository }}"
CC_RELEASE: false
on:
workflow_dispatch:
inputs:
diagnostic_mode:
description: Diagnostic Mode
type: boolean
default: false
required: true
push:
branches:
- '**'
tags-ignore:
- v*
paths-ignore:
- "README.md"
- "LICENSE"
- ".github/**/*"
jobs:
vars:
name: Get Variables
runs-on: ubuntu-22.04
outputs:
version: ${{steps.version.outputs.version}}
mcVersion: ${{steps.gradle_props.outputs.minecraft_version}}
forgeVersion: ${{steps.gradle_props.outputs.forge_version}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Version
id: version
uses: paulhatch/[email protected]
with:
change_path: "forge-api/ forge-main/"
version_format: "${major}.${minor}.${patch}.${increment}-nightly"
search_commit_body: true
bump_each_commit: true
- name: Read MC and Forge versions
id: gradle_props
uses: christian-draeger/[email protected]
with:
path: "gradle.properties"
properties: "minecraft_version forge_version"
build-info:
name: Build Info
runs-on: ubuntu-22.04
needs: [ vars ]
steps:
- name: Output
run: |
echo "Version: ${{ needs.vars.outputs.version }}"
echo "Packages URL: ${{ env.GH_PKG_URL }}"
tests:
name: Gradle Tests
runs-on: ubuntu-22.04
needs: [ vars ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Prepare Gradle
uses: gradle/gradle-build-action@v2
- name: Diagnostic Output
if: inputs.diagnostic_mode
run: |
echo "Java Home: ${{env.JAVA_HOME}}"
./gradlew -q dependencies
- name: Directory Structure Diagnostic
if: inputs.diagnostic_mode
run: tree > filetree.txt
- name: Make Directories
run: |
mkdir run
mkdir run/data
mkdir run/test
mkdir forge-main/src/generated
- name: Generate Datagen Assets
run: ./gradlew runData
env:
CC_VERSION: ${{ needs.vars.outputs.version }}
- name: Store Built Assets
if: success()
uses: actions/upload-artifact@v3
with:
name: generated-data
path: forge-main/src/generated/resources
- name: Upload Failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: generated-data-failure
path: .
- name: Test JAR with GameTest Server
run: ./gradlew runGameTestServer
env:
CC_VERSION: ${{ needs.vars.outputs.version }}
- name: Upload build failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-data
path: run/gametest
publish-gh-package:
name: Publish Github Package
runs-on: ubuntu-22.04
needs: [ vars, tests ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow and Get Tags
run: git fetch --prune --unshallow --tags
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Pull Built Data
uses: actions/download-artifact@v3
with:
name: generated-data
path: forge-main/src/generated/resources
- name: Publish gradle nightly jar
run: ./gradlew publishAllLibsPublicationToGitHubPackagesRepository
env:
CC_VERSION: ${{ needs.vars.outputs.version }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
get-package-info:
name: Get Latest Package Info
runs-on: ubuntu-22.04
needs: [ publish-gh-package ]
outputs:
version: ${{ steps.download-info.outputs.version }}
steps:
- name: Download Package Info
id: download-info
uses: compactmods/[email protected]
env:
GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
owner: compactmods
repo: compactcrafting
group: dev.compactmods.compactcrafting
filter: "^compactcrafting-(?:[\\d\\.]+)-nightly.jar$"
outputFile: compactcrafting-nightly.json
- name: Debug output
run: |
echo "Version: ${{ steps.download-info.outputs.version }}"
cat compactcrafting-nightly.json
- name: Read info into variable [latest]
id: info
run: echo "latestJson=$(cat compactcrafting-nightly.json)" >> $GITHUB_OUTPUT
- name: Download JAR and prepare artifacts
run: |
mkdir release
curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name}}"
mv compactcrafting-nightly.json release/compactcrafting-nightly.json
- name: Add Artifact
uses: actions/upload-artifact@v3
with:
name: release
path: release
announce:
name: Discord Announcement
needs: [ vars, get-package-info ]
runs-on: ubuntu-22.04
steps:
- name: Grab JAR and Info
uses: actions/download-artifact@v3
with:
name: release
path: .
- name: Read info into variable [latest]
id: info
run: echo "latestJson=$(cat compactcrafting-nightly.json)" >> $GITHUB_OUTPUT
- name: Announce Release
uses: compactmods/[email protected]
env:
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
with:
filename: ${{ fromJson(steps.info.outputs.latestJson)[0].name}}
channel: ${{ secrets.NIGHTLY_CHANNEL_ID }}
modName: Compact Crafting
modVersion: ${{ needs.get-package-info.outputs.version }}
thumbnail: https://media.forgecdn.net/avatars/thumbnails/324/502/64/64/637440523810696496.png
forgeVersion: ${{ needs.vars.outputs.forgeVersion }}
mcVersion: ${{ needs.vars.outputs.mcVersion }}