Skip to content

Commit 9adda78

Browse files
cscoder69claude
andcommitted
Release check: syntax, mocked run and translations must pass before anything is uploaded
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 212326b commit 9adda78

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,44 @@
11
# Push a version tag (e.g. v1.0.1) to build the addon zip and upload it to CurseForge and
22
# GitHub Releases. Needs the repository secret CF_API_KEY (CurseForge API token) and the
33
# "## X-Curse-Project-ID" line in the .toc.
4+
# The "check" job runs first: syntax, the mocked WoW run (every control clicked, quest log and
5+
# nameplate scenarios) and the translations. If any of it fails, nothing is uploaded.
46
name: Package and release
57

68
on:
79
push:
810
tags:
911
- "v*"
12+
# Run by hand (Actions tab or "gh workflow run") to try the checks; only a tag uploads.
13+
workflow_dispatch:
1014

1115
jobs:
16+
check:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install LuaJIT (Lua 5.1, like WoW)
22+
run: sudo apt-get update -qq && sudo apt-get install -y -qq luajit
23+
24+
- name: Syntax
25+
run: |
26+
for f in Locales.lua CSCoder_QuestIndicator.lua; do
27+
luajit -e "assert(loadfile('$f'))" && echo "$f OK"
28+
done
29+
30+
- name: Mocked WoW run
31+
run: luajit tools/wowmock.lua .
32+
33+
- name: Mocked WoW run from old saved variables
34+
run: luajit tools/wowmock.lua . old
35+
36+
- name: Translations
37+
run: luajit tools/check_translations.lua .
38+
1239
release:
40+
needs: check
41+
if: startsWith(github.ref, 'refs/tags/v')
1342
runs-on: ubuntu-latest
1443
permissions:
1544
contents: write

‎tools/check_translations.lua‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- Lists the panel texts each language still lacks (they fall back to English) and exits with an
2+
-- error when any is missing, so the release check can stop a half-translated version.
3+
-- usage: luajit tools/check_translations.lua <addon dir>
4+
local dir = arg[1] or "."
5+
local ns = {}
6+
assert(loadfile(dir .. "/Locales.lua"))("CSCoder_QuestIndicator", ns)
7+
local en = ns.locales.enUS
8+
-- Same in every language on purpose.
9+
local skip = { POS_X = true, POS_Y = true }
10+
local total = 0
11+
for _, code in ipairs(ns.LANGUAGES) do
12+
if code ~= "enUS" then
13+
local missing = {}
14+
for key in pairs(en) do
15+
if ns.locales[code][key] == nil and not key:match("^FONT_") and not skip[key] then missing[#missing + 1] = key end
16+
end
17+
table.sort(missing)
18+
total = total + #missing
19+
print(code, #missing, table.concat(missing, " "))
20+
end
21+
end
22+
print("missing translations:", total)
23+
os.exit(total > 0 and 1 or 0)

‎tools/wowmock.lua‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,6 @@ for _, e in ipairs(errors) do print(" " .. e) end
237237
local pname = db.profiles.Default and "Default" or db.chars["Tester - Realm"]
238238
local p = db.profiles[pname]
239239
print(pname .. ": scale", p.scale, "offset", p.offset, "style", p.style, "glow", p.glow, "| root.scale", db.scale, "| savedCVars", db.savedCVars and db.savedCVars.SoftTargetIconGameObject)
240+
241+
-- Exit code for the release check: any error or unexpected global fails it.
242+
os.exit((#errors > 0 or #unexpected > 0) and 1 or 0)

0 commit comments

Comments
 (0)