wip
This commit is contained in:
+6
-45
@@ -72,58 +72,19 @@ jobs:
|
||||
- name: Verify Lua Language Server Installation
|
||||
run: ./luals/bin/lua-language-server --version
|
||||
|
||||
- name: Resolve Addon Paths And Update Config
|
||||
- name: Update Json
|
||||
run: |
|
||||
ADDONS_PATH=$(realpath ./.vscode/lua-addons)
|
||||
ADDON_ROOT=$(find "$ADDONS_PATH" -mindepth 1 -maxdepth 1 -type d | head -n 1)
|
||||
LIBRARY_PATH="$ADDON_ROOT/library"
|
||||
FULL_PATH=$(realpath ./.vscode/lua-addons)
|
||||
echo "full-path: $FULL_PATH"
|
||||
|
||||
echo "addons-path: $ADDONS_PATH"
|
||||
echo "addon-root: $ADDON_ROOT"
|
||||
echo "library-path: $LIBRARY_PATH"
|
||||
|
||||
test -d "$ADDON_ROOT"
|
||||
test -d "$LIBRARY_PATH"
|
||||
test -f "$LIBRARY_PATH/DcsTypes.lua"
|
||||
|
||||
jq \
|
||||
--arg addons_path "$ADDONS_PATH" \
|
||||
--arg addon_root "$ADDON_ROOT" \
|
||||
--arg library_path "$LIBRARY_PATH" \
|
||||
'.Lua.workspace.library = [$library_path, $addon_root] | .Lua.workspace.userThirdParty = [$addons_path]' \
|
||||
./.luarc.json > ./.luarc.json.tmp && mv ./.luarc.json.tmp ./.luarc.json
|
||||
jq --arg full_path "$FULL_PATH" '.Lua.workspace.library[0] = $full_path' ./.luarc.json > ./.luarc.tmp.json
|
||||
mv ./.luarc.tmp.json ./.luarc.json
|
||||
|
||||
- name: Show Config
|
||||
run: cat ./.luarc.json
|
||||
|
||||
- name: LuaLS Smoke Test For Addon Globals
|
||||
run: |
|
||||
cat > ./_luals_smoke_test.lua << 'EOF'
|
||||
local now = timer.getTime()
|
||||
local base = Airbase.getByName("TEST")
|
||||
local side = coalition.side.RED
|
||||
return now, base, side
|
||||
EOF
|
||||
|
||||
set -o pipefail
|
||||
|
||||
echo "=== smoke(root) ==="
|
||||
./luals/bin/lua-language-server --check ./_luals_smoke_test.lua --checklevel=Warning --configpath ./.luarc.json 2>&1 | tee ./_luals_smoke_root.log
|
||||
if grep -q "undefined-global" ./_luals_smoke_root.log; then
|
||||
echo "Root smoke test reported undefined-global"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f ./_luals_smoke_test.lua
|
||||
|
||||
- name: Run Lua Language Server
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "Checking Lua files one-by-one to keep addon globals resolution consistent"
|
||||
while IFS= read -r -d '' file; do
|
||||
echo "Checking $file"
|
||||
./luals/bin/lua-language-server --check "$file" --checklevel=Warning --configpath ./.luarc.json
|
||||
done < <(find ./src -type f -name '*.lua' -print0)
|
||||
run: ./luals/bin/lua-language-server --check ./src --checklevel=Warning --configpath ./.luarc.json
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user