Skip to content

Commit 5cb9491

Browse files
committed
ci: add luals workflow
Optional for now; can be run locally with `make luacheck`.
1 parent 7dbbcfd commit 5cb9491

File tree

3 files changed

+94
-5
lines changed

3 files changed

+94
-5
lines changed

.github/workflows/lint.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
sudo luarocks install luacheck
2424
2525
- name: Lint
26-
run: sudo make lint
26+
run: make lint
2727

2828
stylua:
29-
name: stylua
29+
name: Stylua
3030
runs-on: ubuntu-latest
3131
steps:
3232
- uses: actions/checkout@v5
@@ -35,4 +35,12 @@ jobs:
3535
token: ${{ secrets.GITHUB_TOKEN }}
3636
version: latest
3737
# CLI arguments
38-
args: --color always --check lua/
38+
args: --color always --check .
39+
40+
luals:
41+
name: Luals
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v5
45+
- run: make checklua
46+

.luarc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
3+
"runtime": {
4+
"version": "LuaJIT"
5+
},
6+
"workspace": {
7+
"library": [
8+
"$VIMRUNTIME",
9+
"${3rd}/busted/library"
10+
],
11+
"ignoreDir": [
12+
".test-deps",
13+
"tests"
14+
],
15+
"checkThirdParty": "Disable"
16+
},
17+
"diagnostics": {
18+
"groupFileStatus": {
19+
"strict": "Opened",
20+
"strong": "Opened"
21+
},
22+
"groupSeverity": {
23+
"strong": "Warning",
24+
"strict": "Warning"
25+
},
26+
"unusedLocalExclude": [ "_*" ]
27+
}
28+
}

Makefile

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,63 @@
1-
.PHONY: test lint docgen
1+
LUALS_VERSION := 3.15.0
22

3+
DEPDIR ?= .test-deps
4+
CURL ?= curl -sL --create-dirs
5+
6+
ifeq ($(shell uname -s),Darwin)
7+
LUALS_ARCH ?= darwin-arm64
8+
STYLUA_ARCH ?= macos-aarch64
9+
else
10+
LUALS_ARCH ?= linux-x64
11+
STYLUA_ARCH ?= linux-x86_64
12+
endif
13+
14+
LUALS := $(DEPDIR)/lua-language-server-$(LUALS_VERSION)-$(LUALS_ARCH)
15+
LUALS_TARBALL := $(LUALS).tar.gz
16+
LUALS_URL := https://github.com/LuaLS/lua-language-server/releases/download/$(LUALS_VERSION)/$(notdir $(LUALS_TARBALL))
17+
18+
.PHONY: luals
19+
luals: $(LUALS)
20+
21+
$(LUALS):
22+
$(CURL) $(LUALS_URL) -o $(LUALS_TARBALL)
23+
mkdir $@
24+
tar -xf $(LUALS_TARBALL) -C $@
25+
rm -rf $(LUALS_TARBALL)
26+
27+
STYLUA := $(DEPDIR)/stylua-$(STYLUA_ARCH)
28+
STYLUA_TARBALL := $(STYLUA).zip
29+
STYLUA_URL := https://github.com/JohnnyMorganz/StyLua/releases/latest/download/$(notdir $(STYLUA_TARBALL))
30+
31+
.PHONY: stylua
32+
stylua: $(STYLUA)
33+
34+
$(STYLUA):
35+
$(CURL) $(STYLUA_URL) -o $(STYLUA_TARBALL)
36+
unzip $(STYLUA_TARBALL) -d $(STYLUA)
37+
rm -rf $(STYLUA_TARBALL)
38+
39+
.PHONY: formatlua
40+
formatlua: $(STYLUA)
41+
$(STYLUA)/stylua .
42+
43+
.PHONY: checklua
44+
checklua: $(LUALS) $(NVIM)
45+
VIMRUNTIME=$(NVIM_RUNTIME) $(LUALS)/bin/lua-language-server \
46+
--configpath=../.luarc.json \
47+
--check=./
48+
49+
.PHONY: test
350
test:
451
nvim --headless --noplugin -u scripts/minimal_init.vim -c "PlenaryBustedDirectory lua/tests/automated/ { minimal_init = './scripts/minimal_init.vim' }"
552

6-
lint:
53+
.PHONY: lint
54+
luacheck:
755
luacheck lua/telescope
856

57+
.PHONY: docgen
958
docgen:
1059
nvim --headless --noplugin -u scripts/minimal_init.vim -c "luafile ./scripts/gendocs.lua" -c 'qa'
60+
61+
.PHONY: clean
62+
clean:
63+
rm -rf $(DEPDIR)

0 commit comments

Comments
 (0)