Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add luals check on ci #316

Merged
merged 5 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
types: [opened, synchronize]

env:
LUA_LS_VERSION: 3.7.4

concurrency:
group: github.head_ref
cancel-in-progress: true
Expand Down Expand Up @@ -64,12 +67,29 @@ jobs:
path: _neovim
key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}

- name: restore luals cache
uses: actions/cache@v4
id: cache
with:
path: .ci/lua-ls
key: ${{ env.LUA_LS_VERSION }}

- name: setup luals
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: mkdir -p .ci/lua-ls && curl -sL "https://github.com/LuaLS/lua-language-server/releases/download/${{ env.LUA_LS_VERSION }}/lua-language-server-${{ env.LUA_LS_VERSION }}-linux-x64.tar.gz" | tar xzf - -C "${PWD}/.ci/lua-ls"

- name: setup neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.neovim_version }}

- name: run luals
run: |
export PATH="${PWD}/.ci/lua-ls/bin:${PATH}"
nvim --version
make luals-ci

- name: run tests
run: make test-ci

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
deps
**.DS_Store
.luarc.json
.ci
4 changes: 4 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
globals = { "vim", "MiniTest" }
max_line_length = false

exclude_files = { "deps" }
11 changes: 11 additions & 0 deletions .luarc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"runtime.version": "LuaJIT",
"diagnostics.globals": [
"vim",
"MiniTest"
],
"workspace.library": [
"/usr/local/share/nvim/runtime/lua",
".ci/neovim/share/nvim/runtime/lua"
]
}
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

TESTFILES=options mappings API splits tabs integrations buffers colors autocmds scratchpad commands

all:
all: documentation lint luals test

test:
make deps
nvim --version | head -n 1 && echo ''
nvim --headless --noplugin -u ./scripts/minimal_init.lua \
-c "lua MiniTest.run({ execute = { reporter = MiniTest.gen_reporter.stdout({ group_depth = 2 }) } })"
Expand All @@ -21,22 +22,19 @@ $(addprefix test-, $(TESTFILES)): test-%:
nvim --version | head -n 1 && echo ''
nvim --headless --noplugin -u ./scripts/minimal_init.lua \
-c "lua MiniTest.run_file('tests/test_$*.lua', { execute = { reporter = MiniTest.gen_reporter.stdout({ group_depth = 2 }) } })"

deps:
@mkdir -p deps
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim deps/plenary
git clone --depth 1 https://github.com/echasnovski/mini.nvim deps/mini.nvim
git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter deps/nvim-treesitter
git clone --depth 1 https://github.com/nvim-treesitter/playground deps/playground
git clone --depth 1 https://github.com/nvim-neotest/neotest deps/neotest
git clone --depth 1 https://github.com/nvim-tree/nvim-tree.lua deps/nvimtree
git clone --depth 1 https://github.com/nvim-neo-tree/neo-tree.nvim deps/neo-tree
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim deps/plenary
git clone --depth 1 https://github.com/nvim-tree/nvim-web-devicons deps/nvim-web-devicons
git clone --depth 1 https://github.com/MunifTanjim/nui.nvim deps/nui
git clone --depth 1 https://github.com/antoinemadec/FixCursorHold.nvim deps/fixcursorhold
git clone --depth 1 https://github.com/mfussenegger/nvim-dap deps/nvimdap
git clone --depth 1 https://github.com/rcarriga/nvim-dap-ui deps/nvimdapui


test-ci: deps test

Expand All @@ -47,3 +45,13 @@ documentation-ci: deps documentation

lint:
stylua . -g '*.lua' -g '!deps/' -g '!nightly/'

luals-ci:
rm -rf .ci/lua-ls/log
lua-language-server --configpath .luarc.json --logpath .ci/lua-ls/log --check .
[ -f .ci/lua-ls/log/check.json ] && { cat .ci/lua-ls/log/check.json 2>/dev/null; exit 1; } || true

luals:
mkdir -p .ci/lua-ls
curl -sL "https://github.com/LuaLS/lua-language-server/releases/download/3.7.4/lua-language-server-3.7.4-darwin-x64.tar.gz" | tar xzf - -C "${PWD}/.ci/lua-ls"
make luals-ci
2 changes: 1 addition & 1 deletion tests/test_buffers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ T["curr"]["closing `curr` window without any other window quits Neovim"] = funct

-- neovim is closed, so it errors
Helpers.expect.error(function()
helpers.winsInTab(child)
Helpers.winsInTab(child)
end)
end

Expand Down
Loading