Skip to content

Commit 5e2e667

Browse files
committed
ci: download lua-language-server binary
1 parent a5bdd3f commit 5e2e667

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

scripts/lls-check

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,40 @@
22

33
# Performs a lua-language-server check on all files.
44
# lls-check/check.json will be produced on any issues, returning 1.
5+
# Outputs check.json to stdout, all messages to stderr, to allow jq etc.
56

6-
rm -rf lls-check
7-
mkdir lls-check
7+
VER_LLS="3.7.3"
88

9-
OUT=$(lua-language-server --checklevel=Information --check . --logpath=lls-check --loglevel=error)
10-
echo "${OUT}"
9+
DIR_SRC="${PWD}"
10+
DIR_OUT="${DIR_SRC}/lls-out"
11+
DIR_LLS="/tmp/lls"
12+
13+
# clear output
14+
rm -rf "${DIR_OUT}"
15+
mkdir "${DIR_OUT}"
16+
17+
if [ ! -d "${DIR_LLS}" ]; then
18+
# download lua-language-server binaries
19+
mkdir -p "${DIR_LLS}"
20+
curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${VER_LLS}/lua-language-server-${VER_LLS}-linux-x64.tar.gz" | tar zx --directory "${DIR_LLS}"
21+
fi
22+
23+
# execute from within the lua-language-server directory as it expects specific file locations
24+
cd "${DIR_LLS}"
25+
OUT=$("${DIR_LLS}/bin/lua-language-server" --checklevel=Information --check "${DIR_SRC}" --logpath="${DIR_OUT}" --loglevel=error)
26+
echo "${OUT}" >&2
1127

1228
RC=$?
1329
if [ $RC -ne 0 ]; then
1430
echo "failed with RC=$RC"
1531
exit $RC
1632
fi
1733

34+
# any output is a fail
1835
case "${OUT}" in
19-
*Diagnosis\ completed*)
20-
if [ -f "lls-check/check.json" ]; then
36+
*Diagnosis\ complete*)
37+
if [ -f "${DIR_OUT}/check.json" ]; then
38+
cat "${DIR_OUT}/check.json"
2139
exit 1
2240
else
2341
exit 0

0 commit comments

Comments
 (0)