Skip to content

Commit ed952e9

Browse files
authored
Automatically check if the ModCache needs to be regenerated (#1362)
1 parent 50055a8 commit ed952e9

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,19 @@ jobs:
1616
run: busted --lua=luajit
1717
- name: Report coverage
1818
run: cd src; luacov-coveralls --repo-token=${{ secrets.github_token }} -e TestData -e Data -e runtime
19+
check_modcache:
20+
runs-on: ubuntu-latest
21+
container: ghcr.io/pathofbuildingcommunity/pathofbuilding-tests:latest
22+
steps:
23+
- name: Install git dependency
24+
run: apk add git
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Regenerate ModCache
28+
env:
29+
LUA_PATH: ../runtime/lua/?.lua;../runtime/lua/?/init.lua
30+
REGENERATE_MOD_CACHE: 1
31+
run: cd src; luajit HeadlessWrapper.lua
32+
- run: git config --global --add safe.directory $(pwd)
33+
- name: Check if the generated ModCache is different
34+
run: git diff --exit-code src/Data/ModCache.lua

src/Modules/Main.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function main:Init()
110110
self:ChangeUserPath(self.userPath, ignoreBuild)
111111
end
112112

113-
if launch.devMode and IsKeyDown("CTRL") then
113+
if launch.devMode and IsKeyDown("CTRL") or os.getenv("REGENERATE_MOD_CACHE") == "1" then
114114
-- If modLib.parseMod doesn't find a cache entry it generates it.
115115
-- Not loading pre-generated cache causes it to be rebuilt
116116
self.saveNewModCache = true

0 commit comments

Comments
 (0)