Skip to content

Commit ce167ec

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

File tree

3 files changed

+92
-5
lines changed

3 files changed

+92
-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: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,61 @@
1-
.PHONY: test lint docgen
1+
DEPDIR ?= .test-deps
2+
CURL ?= curl -sL --create-dirs
23

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

6-
lint:
51+
.PHONY: lint
52+
luacheck:
753
luacheck lua/telescope
854

55+
.PHONY: docgen
956
docgen:
1057
nvim --headless --noplugin -u scripts/minimal_init.vim -c "luafile ./scripts/gendocs.lua" -c 'qa'
58+
59+
.PHONY: clean
60+
clean:
61+
rm -rf $(DEPDIR)

0 commit comments

Comments
 (0)