Reviewed-on: #49 Co-authored-by: dutchie031 <timrorije@gmail.com>
This commit was merged in pull request #49.
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
name: PR Prerequisites
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
|
||||
env:
|
||||
LUA_VERSION: "5.1"
|
||||
LUA_LANGUAGE_SERVER_VERSION: "3.19.1"
|
||||
|
||||
jobs:
|
||||
bundles_without_error:
|
||||
runs-on: ubuntu-latest
|
||||
name: Bundles Without Errors
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Lua
|
||||
uses: leafo/gh-actions-lua@v13
|
||||
with:
|
||||
luaVersion: ${{ env.LUA_VERSION }}
|
||||
|
||||
- name: Compile Spearhead
|
||||
uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools/github-actions/bundle-script@bundle-script/v1
|
||||
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
|
||||
|
||||
# "lfs",
|
||||
# "setmetatable", "getmetatable", "table", "string", "math", "pairs", "ipairs",
|
||||
# "require", "type", "tostring", "io", "error", "pcall", "tonumber",
|
||||
# "loadstring",
|
||||
|
||||
- name: Create LuaCheck Config
|
||||
run: |
|
||||
cat << EOF > .luacheckrc
|
||||
|
||||
stds.spearhead_lib = {
|
||||
globals = {
|
||||
"SpearheadConfig", "SpearheadAPI", "GlobalCapCallBacks",
|
||||
}
|
||||
}
|
||||
|
||||
stds.dcs_lib = {
|
||||
globals = {
|
||||
"env", "net", "trigger", "timer", "Object", "land", "coord", "coalition",
|
||||
"Unit", "Group", "Airbase", "StaticObject", "SceneryObject", "world",
|
||||
"country", "missionCommands", "Controller", "Weapon", "atmosphere", "country",
|
||||
"lfs", "AI"
|
||||
}
|
||||
}
|
||||
|
||||
std = "lua51c+spearhead_lib+dcs_lib"
|
||||
self = false
|
||||
|
||||
max_line_length = false
|
||||
EOF
|
||||
|
||||
- name: Show LuaCheck Config
|
||||
run: cat .luacheckrc
|
||||
|
||||
- name: Lint Compiled Output
|
||||
run: luacheck ./output/spearhead.lua
|
||||
|
||||
lua_check:
|
||||
runs-on: ubuntu-latest
|
||||
name: Lua Check
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Lua
|
||||
uses: leafo/gh-actions-lua@v13
|
||||
with:
|
||||
luaVersion: ${{ env.LUA_VERSION }}
|
||||
|
||||
- name: Install Dcs Plugins
|
||||
uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools/github-actions/install-lua-addon@install-lua-addon/v1
|
||||
with:
|
||||
destination-path: "./.vscode/lua-addons" ##same as local so .luarc.json can be the same
|
||||
|
||||
- name: Verify Dcs Plugins Installation
|
||||
run: ls -la ./.vscode/lua-addons
|
||||
|
||||
- name: Install lua-language-server
|
||||
run: |
|
||||
mkdir -p ./luals
|
||||
# For Ubuntu/Debian
|
||||
wget https://github.com/LuaLS/lua-language-server/releases/download/${{ env.LUA_LANGUAGE_SERVER_VERSION }}/lua-language-server-${{ env.LUA_LANGUAGE_SERVER_VERSION }}-linux-x64.tar.gz
|
||||
tar -xzf lua-language-server-*.tar.gz -C ./luals
|
||||
rm lua-language-server-*.tar.gz
|
||||
|
||||
- name: Verify Lua Language Server Installation
|
||||
run: ./luals/bin/lua-language-server --version
|
||||
|
||||
- name: Update Json
|
||||
run: |
|
||||
FULL_PATH=$(realpath ./.vscode/lua-addons)
|
||||
echo "full-path: $FULL_PATH"
|
||||
ls -R $FULL_PATH
|
||||
|
||||
echo "Updating .luarc.json with full path"
|
||||
jq --arg full_path "$FULL_PATH" '.workspace.library[0] = $full_path' ./.luarc.json > ./.luarc.tmp.json
|
||||
mv ./.luarc.tmp.json ./.luarc.json
|
||||
|
||||
- name: Show Config
|
||||
run: cat ./.luarc.json
|
||||
|
||||
- name: Run Lua Language Server
|
||||
run: |
|
||||
CONFIG_FULL_PATH=$(realpath ./.luarc.json)
|
||||
echo "Config full path: $CONFIG_FULL_PATH"
|
||||
|
||||
|
||||
./luals/bin/lua-language-server \
|
||||
--check ./src \
|
||||
--checklevel=Warning \
|
||||
--loglevel=trace \
|
||||
--logpath="./luals/logs" \
|
||||
--configpath="$CONFIG_FULL_PATH" \
|
||||
# --develop
|
||||
|
||||
- name: Show Log
|
||||
if: failure()
|
||||
run: |
|
||||
ls -R ./luals/logs
|
||||
|
||||
cat ./luals/logs/* || true
|
||||
Reference in New Issue
Block a user