From 75f44790159d489adf93e3bceb76d85eb36a1b74 Mon Sep 17 00:00:00 2001 From: Jan Steinke Date: Tue, 9 Apr 2024 22:10:15 +0200 Subject: [PATCH 1/4] add tests to CI --- .github/workflows/test.yaml | 19 +++++++++++++++++++ Makefile | 2 ++ lua/lsp-preview/diff.lua | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yaml create mode 100644 Makefile diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..7afb128 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,19 @@ +name: Test + +on: [push] + +jobs: + + test: + name: Run Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: rhysd/action-setup-vim@v1 + id: vim + with: + neovim: true + version: 0.9.5 + + - name: run test + run: make test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ba1752a --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +test: + nvim --headless -u ./tests/minimal_init.lua -i NONE -n --noplugin -c 'PlenaryBustedDirectory tests' diff --git a/lua/lsp-preview/diff.lua b/lua/lsp-preview/diff.lua index f2904a3..7032c77 100644 --- a/lua/lsp-preview/diff.lua +++ b/lua/lsp-preview/diff.lua @@ -3,7 +3,6 @@ -- for their work <3 local lEdits = require("lsp-preview.buffer_edits") -local minidiff = require("mini.diff") local M = {} @@ -153,6 +152,7 @@ end ---@return string filetype function Edit:preview(bufnr, winid, opts) + local minidiff = require("mini.diff") opts = opts or {} -- set lines in buffer to the changed output From 8e8325e2921e31de9f0495416b802888ac780b78 Mon Sep 17 00:00:00 2001 From: Jan Steinke Date: Tue, 9 Apr 2024 22:12:37 +0200 Subject: [PATCH 2/4] add v to version --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7afb128..9222b04 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,7 +13,7 @@ jobs: id: vim with: neovim: true - version: 0.9.5 + version: v0.9.5 - name: run test run: make test From 2208af06dfc8b2169fbbbb98edab741facad2263 Mon Sep 17 00:00:00 2001 From: Jan Steinke Date: Tue, 9 Apr 2024 22:21:36 +0200 Subject: [PATCH 3/4] add dependencies --- .github/workflows/test.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9222b04..42d8880 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,5 +15,20 @@ jobs: neovim: true version: v0.9.5 + - name: Prepare dependencies + run: | + mkdir -p ~/.local/share/nvim/site/pack/vendor/start + git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim + git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter ~/.local/share/nvim/site/pack/vendor/start/nvim-treesitter + git clone --depth 1 https://github.com/nvim-neotest/nvim-nio ~/.local/share/nvim/site/pack/vendor/start/nvim-nio + ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start + export PATH="${PWD}/_neovim/bin:${PATH}" + export VIM="${PWD}/_neovim/share/nvim/runtime" + nvim --headless -c 'TSInstallSync lua | quit' + - name: run test - run: make test + run: | + export PATH="${PWD}/_neovim/bin:${PATH}" + export VIM="${PWD}/_neovim/share/nvim/runtime" + nvim --version + make test From 61bb86983d6218321077c9fb9f9f0ad5fe560238 Mon Sep 17 00:00:00 2001 From: Jan Steinke Date: Tue, 9 Apr 2024 22:24:10 +0200 Subject: [PATCH 4/4] remove local _neovim dir --- .github/workflows/test.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 42d8880..ad2c284 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,13 +22,9 @@ jobs: git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter ~/.local/share/nvim/site/pack/vendor/start/nvim-treesitter git clone --depth 1 https://github.com/nvim-neotest/nvim-nio ~/.local/share/nvim/site/pack/vendor/start/nvim-nio ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start - export PATH="${PWD}/_neovim/bin:${PATH}" - export VIM="${PWD}/_neovim/share/nvim/runtime" nvim --headless -c 'TSInstallSync lua | quit' - name: run test run: | - export PATH="${PWD}/_neovim/bin:${PATH}" - export VIM="${PWD}/_neovim/share/nvim/runtime" nvim --version make test