|
6 | 6 | branches: [ dev ] |
7 | 7 | workflow_dispatch: |
8 | 8 | jobs: |
| 9 | + lint: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + container: ghcr.io/musholic/lastepochplanner-tests:latest |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Download LuaLS Addons |
| 17 | + run: | |
| 18 | + git clone --depth 1 https://github.com/LuaLS/LLS-Addons.git .lls-addons |
| 19 | + cd .lls-addons |
| 20 | + git submodule update --init --depth 1 addons/busted |
| 21 | + git submodule update --init --depth 1 addons/luassert |
| 22 | + git submodule update --init --depth 1 addons/luafilesystem |
| 23 | +
|
| 24 | + - name: Patch .luarc.json for CI + clean up |
| 25 | + run: | |
| 26 | + sed -i 's|${addons}|.lls-addons/addons|g' .luarc.json |
| 27 | + # Delete the Lua 5.3 specific file so it doesn't break LuaJIT parsing |
| 28 | + rm -f runtime/lua/sha1/lua53_ops.lua |
| 29 | + # Delete the ModCache which slows down type checking |
| 30 | + rm -f src/Data/ModCache.lua |
| 31 | + - name: Type Check Code Base |
| 32 | + run: lua-language-server --check . --check_format=json --logpath=. |
| 33 | + - name: Annotate GitHub PR from check.json |
| 34 | + if: always() |
| 35 | + run: | |
| 36 | + LOG_FILE="check.json" |
| 37 | + if [ -f "$LOG_FILE" ]; then |
| 38 | + cat $LOG_FILE | jq -r --arg ws "$GITHUB_WORKSPACE" ' |
| 39 | + to_entries[] | |
| 40 | + # 1. Strip "file://..." prefix and convert to relative path |
| 41 | + (.key | sub("file://"; "") | ltrimstr($ws) | ltrimstr("/")) as $file | |
| 42 | +
|
| 43 | + # 2. Iterate over issues |
| 44 | + .value[] | |
| 45 | + # 3. Map LSP severity (1:Error, 2:Warning) to GH format |
| 46 | + (if .severity == 1 then "error" else "warning" end) as $sev | |
| 47 | +
|
| 48 | + # 4. Convert 0-indexed LSP (line 55, char 0) to 1-indexed GH (line 56, col 1) |
| 49 | + # GitHub requires line and col. Optional: endLine, endColumn |
| 50 | + "::\($sev) file=\($file),line=\(.range.start.line + 1),col=\(.range.start.character + 1),endLine=\(.range.end.line + 1),endColumn=\(.range.end.character + 1)::\($file): \(.message) (code: \(.code))" |
| 51 | + ' |
| 52 | + else |
| 53 | + echo "::warning::check.json not found, skipping annotations." |
| 54 | + fi |
9 | 55 | run_tests: |
10 | 56 | runs-on: ubuntu-latest |
11 | | - container: ghcr.io/pathofbuildingcommunity/pathofbuilding-tests:latest |
| 57 | + container: ghcr.io/musholic/lastepochplanner-tests:latest |
12 | 58 | steps: |
13 | 59 | - name: Checkout |
14 | 60 | uses: actions/checkout@v4 |
|
19 | 65 | run: cd src; luacov-coveralls --repo-token=${{ secrets.github_token }} -e TestData -e Data -e runtime |
20 | 66 | check_modcache: |
21 | 67 | runs-on: ubuntu-latest |
22 | | - container: ghcr.io/pathofbuildingcommunity/pathofbuilding-tests:latest |
| 68 | + container: ghcr.io/musholic/lastepochplanner-tests:latest |
23 | 69 | steps: |
24 | 70 | - name: Install git dependency |
25 | 71 | run: apk add git |
|
0 commit comments