Skip to content

Commit

Permalink
chore: try luals on ci (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Mar 16, 2024
1 parent ca5c80f commit ec8e69a
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7 deletions.
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

0 comments on commit ec8e69a

Please sign in to comment.