Skip to content

Commit

Permalink
Run tests via busted in GHA/CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed Oct 10, 2024
1 parent 27f44d1 commit 7e9eb8f
Show file tree
Hide file tree
Showing 55 changed files with 67 additions and 20 deletions.
10 changes: 9 additions & 1 deletion .busted
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
return {
_all = {
lpath = 'lua/?.lua'
coverage = false,
lpath = "lua/?.lua;lua/?/init.lua",
lua = "~/.luarocks/bin/nlua",
},
default = {
verbose = true
},
tests = {
verbose = true
},
}
20 changes: 13 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,27 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
neovim_version: ['nightly', 'v0.6.1']
neovim_version: ['nightly', 'v0.9.5']

steps:
- uses: actions/checkout@v2
- name: Prepare plenary
run: |
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
ln -s "$(pwd)" ~/.local/share/nvim/site/pack/vendor/start
- uses: actions/checkout@v4

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

- name: Install Lua
uses: leso-kn/gh-actions-lua@master
with:
luaVersion: "5.1"

- name: Install Luarocks
uses: hishamhm/gh-actions-luarocks@master
with:
luarocksVersion: "3.11.0"

- name: Run tests
run: |
nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal.vim'}"
luarocks test --local
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# nvim-lint

An asynchronous linter plugin for Neovim (>= 0.6.0) complementary to the
An asynchronous linter plugin for Neovim (>= 0.9.5) complementary to the
built-in Language Server Protocol support.

## Motivation & Goals
Expand All @@ -18,7 +18,7 @@ results.

## Installation

- Requires Neovim >= 0.6.0
- Requires Neovim >= 0.9.5
- `nvim-lint` is a regular plugin and can be installed via the `:h packages`
mechanism or via a plugin manager.

Expand Down Expand Up @@ -50,7 +50,7 @@ Then setup a autocmd to trigger linting. For example:
au BufWritePost * lua require('lint').try_lint()
```

or with Lua autocmds (requires 0.7):
or with Lua autocmds:

```lua
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
Expand Down Expand Up @@ -579,4 +579,4 @@ busted tests/
[awk]: https://www.gnu.org/software/gawk/
[yq]: https://mikefarah.gitbook.io/yq
[svlint]: https://github.com/dalance/svlint
[slang]: https://github.com/MikePopoloski/slang
[slang]: https://github.com/MikePopoloski/slang
33 changes: 33 additions & 0 deletions nvim-lint-scm-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local _MODREV, _SPECREV = 'scm', '-1'
rockspec_format = "3.0"
package = 'nvim-lint'
version = _MODREV .. _SPECREV
description = {
summary = 'An asynchronous linter plugin for Neovim ',
detailed = [[
nvim-lint runs linters, parses their output, and reports the results via the
vim.diagnostic module.
]],
labels = {
'neovim',
'plugin',
'linter',
},
homepage = 'https://github.com/mfussenegger/nvim-lint',
license = 'GPL-3.0',
}
dependencies = {
'lua >= 5.1, <= 5.4',
}
test_dependencies = {
"nlua",
}
source = {
url = 'git://github.com/mfussenegger/nvim-lint',
}
build = {
type = 'builtin',
copy_directories = {
'doc',
},
}
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions spec/both.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python

import sys

sys.stdout.write('spec/both.py:10: foo\n')
sys.stderr.write('spec/both.py:20: bar\n')
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/compiler_spec.lua → spec/compiler_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ describe('compiler', function()
it('reads errors from both stdout and stderr', function()
local a = vim.api
local bufnr = a.nvim_create_buf(true, true)
a.nvim_buf_set_name(bufnr, "tests/both.py")
a.nvim_buf_set_name(bufnr, "spec/both.py")
a.nvim_set_current_buf(bufnr)
a.nvim_buf_set_option(bufnr, 'errorformat', '%f:%l: %m')
a.nvim_buf_set_option(bufnr, 'makeprg', 'python tests/both.py')
a.nvim_buf_set_option(bufnr, 'makeprg', 'python spec/both.py')

local handles = get_num_handles()
require('lint').try_lint('compiler')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions tests/both.py

This file was deleted.

0 comments on commit 7e9eb8f

Please sign in to comment.