From de81fdf419d5e993fe40781b87ba6d09bc7a4397 Mon Sep 17 00:00:00 2001 From: dutchie031 Date: Tue, 8 Sep 2026 16:40:04 +0200 Subject: [PATCH] added lua check CI step --- .gitea/workflows/pr.yml | 37 +++++++++++++++++++++++++++++++++++++ .luacheckrc | 22 ++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .gitea/workflows/pr.yml create mode 100644 .luacheckrc diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml new file mode 100644 index 0000000..d36f71c --- /dev/null +++ b/.gitea/workflows/pr.yml @@ -0,0 +1,37 @@ +name: PR Prerequisites + +on: + pull_request: + branches: + - main + - develop + +jobs: + bundles_without_error: + runs-on: ubuntu-latest + name: Bundles Without Errors + steps: + - uses: actions/checkout@v2 + - name: Set up Lua + uses: leafo/setup-lua@v1 + with: + lua-version: '5.1' + + - name: Compile Spearhead + uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools/github-action@action/v0 + with: + source-root: ./src + output-file: ./output/spearhead.lua + + - name: Verify Compiled Lua Syntax + run: lua -e "assert(loadfile('./output/spearhead.lua'))" + + - name: Set up Luarocks + uses: leafo/gh-actions-luarocks@v4 + + - name: Install luacheck + run: luarocks install luacheck + + - name: Lint Compiled Output + run: luacheck ./output/spearhead.lua + diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..cebce85 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,22 @@ +std = "lua51" + +max_line_length = false + +-- Compiled bundle is a single file; each source file's locals live inside +-- their own `do ... end` block, so cross-file shadowing isn't a real risk. +unused_args = false + +-- Cross-file globals set by Spearhead itself (no `require`/module system in the bundle) +globals = { + "SpearheadConfig", + "GlobalCapCallBacks", + "SpearheadAPI", +} + +-- DCS Mission Scripting Environment API +read_globals = { + "env", "timer", "trigger", "world", "coalition", "country", + "AI", "Group", "Unit", "StaticObject", "SceneryObject", + "Airbase", "Weapon", "land", "atmosphere", "missionCommands", + "net", +}