Skip to content

Commit 4181ae4

Browse files
LocalIdentityLocalIdentity
andauthored
Change tests to run in parrallel + cache cleanup (#2049)
The tests before ran in one run without a global cache cleanup This change cuts the peak memory usage from 1.23GB to 940MB which hopefully is enough for the tests to stop failing Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 6c6bf54 commit 4181ae4

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,33 @@ jobs:
99
run_tests:
1010
runs-on: ubuntu-latest
1111
container: ghcr.io/pathofbuildingcommunity/pathofbuilding-tests:latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
shard: [0, 1, 2]
1216
steps:
1317
- name: Checkout
1418
uses: actions/checkout@v4
1519
- name: Run tests
16-
run: busted --lua=luajit
20+
run: |
21+
set -eu
22+
shard_count=3
23+
shard="${{ matrix.shard }}"
24+
index=0
25+
found=0
26+
for spec in $(find spec/System -name '*_spec.lua' | sort); do
27+
if [ $((index % shard_count)) -eq "$shard" ]; then
28+
found=1
29+
echo "::group::$spec"
30+
if ! busted --lua=luajit "../$spec"; then
31+
echo "::endgroup::"
32+
exit 1
33+
fi
34+
echo "::endgroup::"
35+
fi
36+
index=$((index + 1))
37+
done
38+
[ "$found" -eq 1 ]
1739
check_modcache:
1840
runs-on: ubuntu-latest
1941
container: ghcr.io/pathofbuildingcommunity/pathofbuilding-tests:latest

src/HeadlessWrapper.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ build = mainObject.main.modes["BUILD"]
205205

206206
-- Here's some helpful helper functions to help you get started
207207
function newBuild()
208+
if GlobalCache and GlobalCache.cachedData then
209+
wipeGlobalCache()
210+
end
208211
mainObject.main:SetMode("BUILD", false, "Help, I'm stuck in Path of Building!")
209212
runCallback("OnFrame")
210213
end

0 commit comments

Comments
 (0)