Skip to content

Commit

Permalink
ci: fix luals errors and check in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Jan 20, 2025
1 parent 0edca9d commit 2e85a2a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Run Test
run: make test

lint:
stylua:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -65,6 +65,27 @@ jobs:
- name: Lint
run: make stylua-check

luals:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: leafo/gh-actions-lua@v9
with:
luaVersion: "5.1.5"

- uses: leafo/gh-actions-luarocks@v4

- name: Download nvim-test
run: make nvim-test

- name: Download LuaLS
run: make luals

- name: Lint
run: make luals-check

doc:
runs-on: ubuntu-latest
steps:
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ doc/tags

scratch/dummy_ignored.txt

luals

nvim-test

stylua
luals
luals_check
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,14 @@ build: gen_help stylua-run
doc-check: gen_help
git diff --exit-code -- doc

LUALS_VERSION := 3.7.4
LUALS_TARBALL := lua-language-server-$(LUALS_VERSION)-$(shell uname -s)-$(shell uname -m).tar.gz
ifeq ($(shell uname -m),arm64)
LUALS_ARCH ?= arm64
else
LUALS_ARCH ?= x64
endif

LUALS_VERSION := 3.13.5
LUALS_TARBALL := lua-language-server-$(LUALS_VERSION)-$(shell uname -s)-$(LUALS_ARCH).tar.gz
LUALS_URL := https://github.com/LuaLS/lua-language-server/releases/download/$(LUALS_VERSION)/$(LUALS_TARBALL)

luals:
Expand All @@ -97,6 +103,7 @@ luals:
luals-check: luals nvim-test
VIMRUNTIME=$(XDG_DATA_HOME)/nvim-test/nvim-test-$(NVIM_TEST_VERSION)/share/nvim/runtime \
luals/bin/lua-language-server \
--logpath=. \
--logpath=luals_check \
--configpath=../.luarc.json \
--check=lua
@grep '^\[\]$$' luals_check/check.json
4 changes: 2 additions & 2 deletions lua/gitsigns/diff_int.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local async = require('gitsigns.async')
local create_hunk = require('gitsigns.hunks').create_hunk
local config = require('gitsigns.config').config

local decode
local decode --- @type fun(data: string): any
if jit and package.preload['string.buffer'] then
decode = require('string.buffer').decode
else
Expand Down Expand Up @@ -64,7 +64,7 @@ local run_diff_xdl_async = async.awrap(
return bit.band(flags0, bit.lshift(1, pos)) ~= 0
end

local encode
local encode --- @type fun(data: any): string
if jit and package.preload['string.buffer'] then
encode = require('string.buffer').encode
else
Expand Down
4 changes: 3 additions & 1 deletion lua/gitsigns/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ local git_command = require('gitsigns.git.cmd')
--- @param file_buf string
--- @param indent_heuristic? boolean
--- @param diff_algo string
--- @return string[] stdout, string? stderr
--- @return string[] stdout
--- @return string? stderr
--- @return integer code
function M.diff(file_cmp, file_buf, indent_heuristic, diff_algo)
return git_command({
'-c',
Expand Down
1 change: 1 addition & 0 deletions lua/gitsigns/system/compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ local function system(cmd, opts, on_exit)
if opts.timeout then
state.timer = timer_oneshot(opts.timeout, function()
if state.handle and state.handle:is_active() then
--- @diagnostic disable-next-line: invisible
obj:_timeout()
end
end)
Expand Down

0 comments on commit 2e85a2a

Please sign in to comment.