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 - name: Create LuaCheck Config run: | cat << EOF > .luacheckrc std = { globals = { "lfs", "setmetatable",getmetatable", "table", "string", "math", "pairs", "ipairs", "require", "type", "tostring", "io", "error", "pcall", "tonumber", "SpearheadConfig", "env", "net", "trigger", "timer", "Object", "land", "coord", "coalition", "Unit", "Group", "Airbase", "StaticObject", "SceneryObject", "world" }, } 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