From 9f1cf36d8f5d7c0ce179e1328a12b031261ae9ef Mon Sep 17 00:00:00 2001 From: shinokun Date: Sat, 25 Jul 2026 21:49:02 +0900 Subject: [PATCH] ci: add lua-language-server type-check job (non-blocking for now) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a `typecheck` job that runs `lua-language-server --check` over the Lua sources. lazydev only supplies type libraries inside Neovim, so the job reproduces that parity for standalone LuaLS: it restores plugins into the nvim-dev data dir (shared cache with `check`), then injects `workspace.library` = $VIMRUNTIME + the installed plugin `lua` dirs into a committed base config (.github/luarc.ci.json) written as the effective .luarc.json. `--check` exits non-zero on problems, so the exit code is the signal (this LuaLS version writes no check.json). checklevel is Warning. `undefined-field` is disabled for now: every current finding was a false positive from LuaSnip's incomplete field annotations (ls.text_node, etc.); the useful diagnostics (type mismatches, undefined-global, missing-parameter) stay on. The job is intentionally NOT in branch protection yet — informative while it stabilizes, to be promoted to a required check once trusted. Co-Authored-By: Claude Opus 4.8 --- .github/luarc.ci.json | 10 +++++++ .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/luarc.ci.json diff --git a/.github/luarc.ci.json b/.github/luarc.ci.json new file mode 100644 index 0000000..952bbf9 --- /dev/null +++ b/.github/luarc.ci.json @@ -0,0 +1,10 @@ +{ + "runtime.version": "LuaJIT", + "diagnostics.globals": [ + "vim" + ], + "workspace.checkThirdParty": false, + "diagnostics.disable": [ + "undefined-field" + ] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b9a119..bcbf17a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,3 +45,63 @@ jobs: - name: Headless load check run: bin/check + + typecheck: + # Not yet in branch protection: informative while it is stabilized, then + # promoted to a required check once clean. + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Neovim + uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: stable + + - name: Install Deno + # denops.vim / skkeleton may touch Deno during the restore startup. + uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + + - name: Cache plugins + # Shares the key with the `check` job so plugins are installed once. + uses: actions/cache@v4 + with: + path: ~/.local/share/nvim-dev + key: nvim-dev-plugins-${{ hashFiles('lazy-lock.json') }} + restore-keys: nvim-dev-plugins- + + - name: Restore plugins (no startup check) + # Populate the nvim-dev data dir so plugin type definitions are on disk; + # bin/check's full startup check is redundant here. + run: | + ln -sfn "$GITHUB_WORKSPACE" "$HOME/.config/nvim-dev" 2>/dev/null || { + mkdir -p "$HOME/.config" && ln -sfn "$GITHUB_WORKSPACE" "$HOME/.config/nvim-dev" + } + NVIM_APPNAME=nvim-dev nvim --headless "+Lazy! restore" +qa + + - name: Install lua-language-server + run: | + ver=3.18.2 + url="https://github.com/LuaLS/lua-language-server/releases/download/${ver}/lua-language-server-${ver}-linux-x64.tar.gz" + mkdir -p "$HOME/luals" + curl -fsSL "$url" | tar -xz -C "$HOME/luals" + echo "$HOME/luals/bin" >> "$GITHUB_PATH" + + - name: Build CI luarc (inject library paths) + # LuaLS luarc cannot expand env vars, so resolve $VIMRUNTIME and the + # installed plugin lua dirs here and write the effective .luarc.json. + # This mirrors what lazydev supplies in-editor. + run: | + vimruntime="$(nvim --headless --clean -c 'lua io.write(vim.env.VIMRUNTIME)' -c 'qa' 2>/dev/null)" + libs="$(printf '%s\n' "$vimruntime" "$HOME"/.local/share/nvim-dev/lazy/*/lua | jq -R . | jq -s .)" + jq --argjson libs "$libs" '. + {"workspace.library": $libs}' .github/luarc.ci.json > .luarc.json + echo "Effective .luarc.json:"; cat .luarc.json + + - name: lua-language-server --check + # --check prints diagnostics and exits non-zero when problems are + # found, so the exit code is the signal (this version writes no + # check.json). + run: lua-language-server --check . --checklevel Warning --logpath /tmp/luals-log