Skip to content

Commit a5fc152

Browse files
committed
fix: compile against BanManager from source and clean up bot on kick
- Checkout BanManager and publishToMavenLocal in both CI workflows so WebEnhancer always compiles against the latest API (Fabric Stonecutter artifacts are not reliably published to Maven Central snapshots) - Clean up mineflayer bot (removeAllListeners + end) on kick/error during connect() and waitForKick() to prevent physics timers running after Jest teardown
1 parent a589593 commit a5fc152

3 files changed

Lines changed: 31 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v4
2828

29+
- uses: actions/checkout@v4
30+
with:
31+
repository: BanManagement/BanManager
32+
path: BanManager
33+
ref: master
34+
2935
- name: Set up JDK 17
3036
uses: actions/setup-java@v4
3137
with:
@@ -47,13 +53,17 @@ jobs:
4753
with:
4854
path: |
4955
.gradle/loom-cache
50-
key: ${{ runner.os }}-loom-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}-${{ github.run_id }}
56+
key: ${{ runner.os }}-loom-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}
5157
restore-keys: ${{ runner.os }}-loom-
5258

59+
- name: Publish BanManager to Maven Local
60+
working-directory: BanManager
61+
run: ./gradlew publishToMavenLocal --build-cache
62+
5363
- name: Execute Gradle build
5464
env:
5565
STORAGE_TYPE: ${{ matrix.storageType }}
56-
run: ./gradlew build --build-cache --refresh-dependencies --info
66+
run: ./gradlew build --build-cache --info
5767

5868
- name: Build all Fabric versions
5969
run: ./gradlew :fabric:1.20.1:remapJar :fabric:1.21.1:remapJar :fabric:1.21.4:remapJar :fabric:1.21.11:remapJar --build-cache

.github/workflows/e2e.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,13 @@ jobs:
132132
with:
133133
path: |
134134
.gradle/loom-cache
135-
key: ${{ runner.os }}-loom-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}-${{ github.run_id }}
135+
key: ${{ runner.os }}-loom-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}
136136
restore-keys: ${{ runner.os }}-loom-
137137

138+
- name: Publish BanManager to Maven Local
139+
working-directory: BanManager
140+
run: ./gradlew publishToMavenLocal --build-cache
141+
138142
# Docker Buildx for better caching
139143
- name: Set up Docker Buildx
140144
uses: docker/setup-buildx-action@v3

e2e/tests/src/helpers/bot.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,16 @@ export class TestBot {
115115
version: MC_VERSION
116116
})
117117

118+
const cleanup = (): void => {
119+
if (this.bot != null) {
120+
this.bot.removeAllListeners()
121+
this.bot.end()
122+
this.bot = null
123+
}
124+
}
125+
118126
const timeout = setTimeout(() => {
127+
cleanup()
119128
reject(new Error('Bot connection timeout'))
120129
}, 30000)
121130

@@ -127,13 +136,15 @@ export class TestBot {
127136

128137
this.bot.once('error', (err) => {
129138
clearTimeout(timeout)
139+
cleanup()
130140
reject(err)
131141
})
132142

133143
this.bot.once('kicked', (reason) => {
134144
clearTimeout(timeout)
135145
const reasonText = extractKickReason(reason)
136146
console.log(`Bot ${this._username} was kicked: ${reasonText}`)
147+
cleanup()
137148
reject(new Error(`Bot ${this._username} was kicked: ${reasonText}`))
138149
})
139150

@@ -347,7 +358,8 @@ export class TestBot {
347358
if (settled) return
348359
settled = true
349360
clearTimeout(timeout)
350-
bot.removeAllListeners('end')
361+
bot.removeAllListeners()
362+
bot.end()
351363
this.bot = null
352364
resolve(extractKickReason(reason))
353365
})
@@ -360,7 +372,7 @@ export class TestBot {
360372
if (settled) return
361373
settled = true
362374
clearTimeout(timeout)
363-
bot.removeAllListeners('kicked')
375+
bot.removeAllListeners()
364376
this.bot = null
365377
reject(new Error(`Bot disconnected before kick: ${reason}`))
366378
}, 500)

0 commit comments

Comments
 (0)