-
-
Notifications
You must be signed in to change notification settings - Fork 92
257 lines (228 loc) · 8.28 KB
/
Copy pathe2e.yml
File metadata and controls
257 lines (228 loc) · 8.28 KB
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
name: E2E Tests
permissions:
contents: read
packages: read
on:
pull_request:
push:
branches:
- master
- release/v7
workflow_dispatch: # Allow manual triggering
jobs:
build-jars:
runs-on: ubuntu-latest
name: Build plugin artifacts
steps:
- uses: actions/checkout@v4
# Also set up JDK 17 for Fabric 1.20.x builds
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "temurin"
# Ensure JDK 21 is the default
- name: Set JDK 21 as default
run: echo "JAVA_HOME=$JAVA_HOME_21_X64" >> $GITHUB_ENV
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
- uses: actions/cache@v4
with:
path: |
.gradle/loom-cache
key: ${{ runner.os }}-loom-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-loom-
- name: Build plugin JARs
run: >
./gradlew
:BanManagerBukkit:shadowJar
:BanManagerBungee:shadowJar
:BanManagerVelocity:shadowJar
:BanManagerSponge:shadowJar
:fabric:1.20.1:remapJar
:fabric:1.21.1:remapJar
:fabric:1.21.4:remapJar
:fabric:1.21.11:remapJar
--build-cache
- name: Upload plugin artifacts
uses: actions/upload-artifact@v4
with:
name: e2e-plugin-jars
path: |
bukkit/build/libs/BanManagerBukkit.jar
bungee/build/libs/BanManagerBungeeCord.jar
velocity/build/libs/BanManagerVelocity.jar
sponge/build/libs/BanManagerSponge.jar
fabric/versions/1.20.1/build/libs/BanManagerFabric-mc1.20.1.jar
fabric/versions/1.21.1/build/libs/BanManagerFabric-mc1.21.1.jar
fabric/versions/1.21.4/build/libs/BanManagerFabric-mc1.21.4.jar
fabric/versions/1.21.11/build/libs/BanManagerFabric-mc1.21.11.jar
retention-days: 7
e2e:
needs: build-jars
runs-on: ubuntu-latest
name: E2E - ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
include:
# Bukkit/Paper
- platform: Bukkit
task: testBukkit
compose_dir: platforms/bukkit
# Fabric 1.20.1 (legacy modded, Java 17)
- platform: Fabric-1.20.1
task: testFabric_1_20_1
compose_dir: platforms/fabric
mc_version: "1.20.1"
java_image: "java17"
fabric_loader: "0.16.10"
# Fabric 1.21.1 (stable 1.21, Java 21)
- platform: Fabric-1.21.1
task: testFabric_1_21_1
compose_dir: platforms/fabric
mc_version: "1.21.1"
java_image: "java21"
fabric_loader: "0.16.9"
# Fabric 1.21.4 (current latest, Java 21)
- platform: Fabric-1.21.4
task: testFabric_1_21_4
compose_dir: platforms/fabric
mc_version: "1.21.4"
java_image: "java21"
fabric_loader: "0.16.9"
# Fabric 1.21.11 (current latest, Java 21)
- platform: Fabric-1.21.11
task: testFabric_1_21_11
compose_dir: platforms/fabric
mc_version: "1.21.11"
java_image: "java21"
fabric_loader: "0.17.3"
# Sponge API 11 (MC 1.20.6, Java 21)
- platform: Sponge-1.20.6
task: testSponge_1_20_6
compose_dir: platforms/sponge
mc_version: "1.20.6"
java_image: "java21"
spongeversion: "1.20.6-11.0.0"
# Sponge API 12 (MC 1.21.1, Java 21)
- platform: Sponge-1.21.1
task: testSponge_1_21_1
compose_dir: platforms/sponge
mc_version: "1.21.1"
java_image: "java21"
spongeversion: "1.21.1-12.0.2"
# Sponge API 13 (MC 1.21.3, Java 21)
- platform: Sponge-1.21.3
task: testSponge_1_21_3
compose_dir: platforms/sponge
mc_version: "1.21.3"
java_image: "java21"
spongeversion: "1.21.3-13.0.0"
# Velocity Proxy
- platform: Velocity
task: testVelocity
compose_dir: platforms/velocity
# BungeeCord Proxy
- platform: BungeeCord
task: testBungee
compose_dir: platforms/bungee
steps:
- uses: actions/checkout@v4
- name: Download plugin artifacts
uses: actions/download-artifact@v4
with:
name: e2e-plugin-jars
path: .
- name: Detect E2E runner image input changes
id: runner_changes
uses: dorny/paths-filter@v3
with:
filters: |
runner_image_inputs:
- "e2e/Dockerfile.tests"
- "e2e/tests/**"
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "temurin"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
- name: Resolve test runner image
run: |
IMAGE_REPO="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/banmanager-e2e-tests"
echo "E2E_IMAGE_REPO=$IMAGE_REPO" >> "$GITHUB_ENV"
if [[ "${{ steps.runner_changes.outputs.runner_image_inputs }}" == "true" ]]; then
echo "E2E_TEST_IMAGE_MODE=local" >> "$GITHUB_ENV"
echo "E2E_TEST_IMAGE=e2e-tests:local-${GITHUB_SHA}" >> "$GITHUB_ENV"
exit 0
fi
if [[ "${GITHUB_EVENT_NAME}" == "push" && "${GITHUB_REF}" == "refs/heads/master" ]]; then
SHORT_SHA="${GITHUB_SHA::7}"
echo "E2E_TEST_IMAGE=${IMAGE_REPO}:sha-${SHORT_SHA}" >> "$GITHUB_ENV"
else
echo "E2E_TEST_IMAGE=${IMAGE_REPO}:main" >> "$GITHUB_ENV"
fi
echo "E2E_TEST_IMAGE_MODE=registry" >> "$GITHUB_ENV"
- name: Pull test runner image from GHCR
if: env.E2E_TEST_IMAGE_MODE == 'registry'
run: |
if docker pull "$E2E_TEST_IMAGE"; then
exit 0
fi
FALLBACK_IMAGE="${E2E_IMAGE_REPO}:main"
if docker pull "$FALLBACK_IMAGE"; then
echo "E2E_TEST_IMAGE=$FALLBACK_IMAGE" >> "$GITHUB_ENV"
exit 0
fi
echo "E2E_TEST_IMAGE_MODE=local" >> "$GITHUB_ENV"
echo "E2E_TEST_IMAGE=e2e-tests:local-${GITHUB_SHA}" >> "$GITHUB_ENV"
- name: Build local test runner image when needed
if: env.E2E_TEST_IMAGE_MODE == 'local'
run: docker build -t "$E2E_TEST_IMAGE" -f e2e/Dockerfile.tests e2e
- name: Run E2E tests
run: ./gradlew :BanManagerE2E:${{ matrix.task }}
timeout-minutes: 15
env:
BM_E2E_SKIP_PLUGIN_BUILD: "true"
E2E_TEST_IMAGE: ${{ env.E2E_TEST_IMAGE }}
MC_VERSION: ${{ matrix.mc_version }}
JAVA_IMAGE: ${{ matrix.java_image }}
FABRIC_LOADER: ${{ matrix.fabric_loader }}
SPONGEVERSION: ${{ matrix.spongeversion }}
- name: Collect logs on failure
if: failure()
working-directory: e2e/${{ matrix.compose_dir }}
run: |
docker compose logs > ../../e2e-logs-${{ matrix.platform }}.txt 2>&1 || true
env:
MC_VERSION: ${{ matrix.mc_version }}
JAVA_IMAGE: ${{ matrix.java_image }}
FABRIC_LOADER: ${{ matrix.fabric_loader }}
SPONGEVERSION: ${{ matrix.spongeversion }}
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: e2e-logs-${{ matrix.platform }}
path: e2e-logs-${{ matrix.platform }}.txt
retention-days: 7
- name: Cleanup
if: always()
working-directory: e2e/${{ matrix.compose_dir }}
run: docker compose down -v || true
env:
MC_VERSION: ${{ matrix.mc_version }}
JAVA_IMAGE: ${{ matrix.java_image }}
FABRIC_LOADER: ${{ matrix.fabric_loader }}
SPONGEVERSION: ${{ matrix.spongeversion }}