Skip to content

refactor: overhaul notability checker display #28628

refactor: overhaul notability checker display

refactor: overhaul notability checker display #28628

Workflow file for this run

name: Lua Code Style and Unit Tests
on: [pull_request, workflow_dispatch]
jobs:
lua-code-style:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup lua
uses: Liquipedia/gh-actions-lua@7615c1c345af98bd9898fa5b53c488c5f58246cf
with:
luaVersion: '5.1'
- name: Setup luarock
uses: leafo/gh-actions-luarocks@v6
- name: Setup dependencies
run: |
luarocks install --lua-version=5.1 luacheck
- name: Run lint
run: |
luacheck lua --config lua/.luacheckrc |
luacheck lua --config lua/.luacheckrc --formatter=JUnit > report.xml
- name: Report lint
uses: mikepenz/action-junit-report@v6
if: always()
with:
report_paths: 'report.xml'
check_name: 'Lint Report'
annotate_only: ${{ (github.event.pull_request.head.repo.full_name != github.repository) }}
lua-unit-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup lua
uses: Liquipedia/gh-actions-lua@7615c1c345af98bd9898fa5b53c488c5f58246cf
with:
luaVersion: '5.1'
- name: Setup luarocks
uses: leafo/gh-actions-luarocks@v6
- name: Setup dependencies
run: |
luarocks install --lua-version=5.1 busted
- name: Run test
run: |
busted -C lua -v --run=ci --output=junit > busted.xml
- name: Report test
uses: mikepenz/action-junit-report@v6
if: always()
with:
report_paths: 'busted.xml'
check_name: 'Lua Test Report'
annotate_only: ${{ (github.event.pull_request.head.repo.full_name != github.repository) }}
luals-code-style:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- id: lua-changed-files
uses: tj-actions/changed-files@v47
with:
files: |
lua/wikis/**/*.lua
- name: Setup LuaLS
if: steps.lua-changed-files.outputs.any_changed == 'true'
env:
LUALS_VERSION: 3.18.2
run: |
mkdir -p ~/.local/bin/luals
curl -L https://github.com/LuaLS/lua-language-server/releases/download/$LUALS_VERSION/lua-language-server-$LUALS_VERSION-linux-x64.tar.gz | tar -xzv -C ~/.local/bin/luals
- name: Check
if: steps.lua-changed-files.outputs.any_changed == 'true'
shell: bash
env:
CHANGED_FILES: ${{ steps.lua-changed-files.outputs.all_changed_files }}
run: |
~/.local/bin/luals/bin/lua-language-server --check ./ \
--check_format=json --check_out_path="$PWD/luals-check.json" || true
jq -r --arg root "file://$PWD/" --arg changed "$CHANGED_FILES" '
to_entries[]
| (.key | sub($root; "")) as $file
| select($file | inside($changed))
| .value[]
| (.range.start.line + 1) as $line
| (.range.start.character + 1) as $col
| "::error file=\($file),line=\($line),col=\($col)::\(.message | gsub("\n"; " ")) (\(.code))"
' luals-check.json | tee output.txt
touched=$(wc -l < output.txt)
problems=$(jq -r '[.[] | length] | add // 0' luals-check.json)
files_with=$(jq -r 'length' luals-check.json)
{
echo "| | Files scanned | Files with problems | Problems | In changed files |"
echo "|-|-------|----------|----------|----------|"
echo "| LuaLS check | $(find lua -name '*.lua' | wc -l) | $files_with | $problems | $touched |"
} | tee -a "$GITHUB_STEP_SUMMARY"
exit $(( touched > 0 ? 1 : 0 ))