diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ebc499c..65d4a9e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index 4b3caad..929091c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ deps **.DS_Store -.luarc.json +.ci diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..084dc49 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,4 @@ +globals = { "vim", "MiniTest" } +max_line_length = false + +exclude_files = { "deps" } diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..1b8485f --- /dev/null +++ b/.luarc.json @@ -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" + ] +} diff --git a/Makefile b/Makefile index afcc684..9b73bb5 100644 --- a/Makefile +++ b/Makefile @@ -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 }) } })" @@ -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 @@ -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 diff --git a/tests/test_buffers.lua b/tests/test_buffers.lua index bef3253..2fea2ca 100644 --- a/tests/test_buffers.lua +++ b/tests/test_buffers.lua @@ -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