Skip to content

Commit 6d904d8

Browse files
committed
ci(github): add lint and typecheck workflows
Introduce two GitHub Actions workflows for CI: - `lint.yml` runs Luacheck on the `lua/` directory to enforce code style and catch common Lua issues. - `typecheck.yml` uses `nvim-typecheck-action` to perform static type checking with lua_ls, using the `.luarc.json` config. Also, remove an unused local variable from `test/utils/helpers.lua` for cleaner test helper code.
1 parent 946e559 commit 6d904d8

4 files changed

Lines changed: 65 additions & 2 deletions

File tree

.github/workflows/lint.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Lint
3+
4+
on:
5+
push:
6+
branches:
7+
- "main"
8+
pull_request:
9+
branches:
10+
- "main"
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
lint:
19+
name: Luacheck
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v5
23+
- name: Setup
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install luarocks -y
27+
sudo luarocks install luacheck
28+
29+
- name: Lint
30+
run: luacheck lua/ --globals vim

.github/workflows/typecheck.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: lua_ls-typecheck
3+
4+
on:
5+
push:
6+
branches:
7+
- "main"
8+
pull_request:
9+
branches:
10+
- "main"
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
name: Type Check Code Base
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v5
24+
- uses: stevearc/nvim-typecheck-action@v2
25+
with:
26+
path: lua
27+
level: Warning
28+
configpath: ".luarc.json"

.luarc.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
},
66
"type": {
77
"checkTableShape": true
8-
}
8+
},
9+
"diagnostics.globals": [
10+
"describe",
11+
"it",
12+
"before_each",
13+
"after_each"
14+
]
915
}

test/utils/helpers.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
local helpers = require("nvim-test.helpers")
2-
local command = helpers.api.nvim_command
32
local system = helpers.fn.system
43

54
local M = helpers

0 commit comments

Comments
 (0)