Skip to content

Commit 848f9ab

Browse files
Chore: Add GHA Workflows (#11)
* Add workflows for linting/testing
1 parent dbac1cb commit 848f9ab

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Lint & Test
2+
3+
# Thank you folke and apologies for pinching some of these but
4+
# your CI for neovim plugins is impeccably set up and re-usable
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
stylua:
14+
name: Stylua Formatting
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: JohnnyMorganz/stylua-action@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
version: latest
22+
args: --check lua
23+
24+
luacheck:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
- name: Luacheck linter
30+
uses: lunarmodules/luacheck@v1
31+
32+
debug:
33+
name: Check for Debug Statements
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Check Debug
38+
run: |
39+
if /bin/grep --line-number -r -P '^(?!\s*--).*\bdd\(' --color=always lua; then
40+
echo "Debug messages found"
41+
exit 1
42+
else
43+
echo "No debug messages found"
44+
fi
45+
46+
tests:
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 10
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: folke/github/neovim@main
52+
- name: Install dependencies
53+
run: sudo apt-get update && sudo apt-get install -y libreadline-dev
54+
- name: Test Cache
55+
uses: actions/cache@v4
56+
with:
57+
path: .tests
58+
key: ${{ runner.os }}-tests-${{ hashFiles('tests/minit.lua', 'scripts/test') }}
59+
- name: Run Tests
60+
run: ./scripts/test

.luacheckrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-- vim: ft=lua tw=140
2+
3+
globals = { "vim" }
4+
5+
read_globals = {
6+
"describe",
7+
"it",
8+
"before_each",
9+
"after_each",
10+
"setup",
11+
"teardown",
12+
"assert",
13+
"spy",
14+
"mock",
15+
"stub"
16+
}
17+
18+
ignore = {
19+
"unused_args"
20+
}
21+
22+
files["tests/**/*.lua"] = {
23+
std = "+busted"
24+
}
File renamed without changes.

tests/runner_spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("nvumi.runner", function()
77
local callback_called = false
88

99
---@diagnostic disable-next-line: duplicate-set-field
10-
vim.fn.jobstart = function(args, opts)
10+
vim.fn.jobstart = function(_, opts)
1111
if opts and opts.on_stdout then
1212
opts.on_stdout(0, { "runner result" }, "runner result")
1313
callback_called = true

0 commit comments

Comments
 (0)