Skip to content

Commit c78eee8

Browse files
fix(ci): bump lua version
1 parent 72af0d0 commit c78eee8

File tree

3 files changed

+33
-45
lines changed

3 files changed

+33
-45
lines changed

.github/workflows/lua.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ jobs:
4545
with:
4646
neovim: true
4747
version: ${{ matrix.nvim_version }}
48-
- name: Install luajit
49-
uses: leafo/gh-actions-lua@v11
48+
- uses: leafo/gh-actions-lua@v11
5049
with:
5150
luaVersion: "luajit-openresty"
52-
- name: Install luarocks
53-
uses: leafo/gh-actions-luarocks@v5
51+
- uses: hishamhm/gh-actions-luarocks@master
5452
with:
55-
luarocksVersion: "3.8.0"
53+
luaRocksVersion: "3.12.0"
54+
- name: build
55+
run: |
56+
luarocks install busted
57+
luarocks make
5658
- name: Run tests
5759
shell: bash
5860
run: |

lua-test.sh

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,44 @@
11
#!/usr/bin/env bash
22
#
33
# Setup and run tests for lua part of gitlab.nvim.
4-
#
5-
# In order to run tests you need to have `luarocks` and `git` installed. This script will check if
6-
# environment is already setup, if not it will initialize current directory with `luarocks`,
7-
# install `busted` framework and download plugin dependencies.
8-
#
4+
# Requires `luarocks`, `git`, and `nvim` installed.
95
#
10-
set -e
116

12-
LUA_VERSION="5.1"
7+
set -euo pipefail
8+
139
PLUGINS_FOLDER="tests/plugins"
1410
PLUGINS=(
15-
"https://github.com/MunifTanjim/nui.nvim"
16-
"https://github.com/nvim-lua/plenary.nvim"
17-
"https://github.com/sindrets/diffview.nvim"
11+
"https://github.com/MunifTanjim/nui.nvim"
12+
"https://github.com/nvim-lua/plenary.nvim"
13+
"https://github.com/sindrets/diffview.nvim"
1814
)
1915

20-
if ! command -v luarocks > /dev/null 2>&1; then
21-
echo "You need to have luarocks installed in order to run tests."
22-
exit 1
23-
fi
24-
25-
if ! command -v git > /dev/null 2>&1; then
26-
echo "You need to have git installed in order to run tests."
27-
exit 1
16+
if ! command -v luarocks >/dev/null 2>&1; then
17+
echo "Error: luarocks not found. Please install LuaRocks." >&2
18+
exit 1
2819
fi
2920

30-
if ! luarocks --lua-version=$LUA_VERSION which busted > /dev/null 2>&1; then
31-
echo "Installing busted."
32-
luarocks init
33-
luarocks config --scope project lua_version "$LUA_VERSION"
34-
luarocks install --lua-version="$LUA_VERSION" busted
21+
if ! command -v git >/dev/null 2>&1; then
22+
echo "Error: git not found. Please install Git." >&2
23+
exit 1
3524
fi
3625

37-
for arg in "$@"; do
38-
if [[ $arg =~ "--coverage" ]] && ! luarocks --lua-version=$LUA_VERSION which luacov > /dev/null 2>&1; then
39-
luarocks install --lua-version="$LUA_VERSION" luacov
40-
# lcov reporter for luacov - lcov format is supported by `nvim-coverage`
41-
luarocks install --lua-version="$LUA_VERSION" luacov-reporter-lcov
26+
if ! command -v nvim >/dev/null 2>&1; then
27+
echo "Error: nvim not found. Please install Neovim." >&2
28+
exit 1
4229
fi
43-
done
4430

31+
# Clone test plugin dependencies
32+
mkdir -p "$PLUGINS_FOLDER"
4533
for plugin in "${PLUGINS[@]}"; do
46-
plugin_name=${plugin##*/}
47-
plugin_folder="$PLUGINS_FOLDER/$plugin_name"
48-
49-
# Check if plugin was already downloaded
50-
if [[ -d "$plugin_folder/.git" ]]; then
51-
# We could also try to pull here but I am not sure if that wouldn't slow down tests too much.
52-
continue
53-
fi
54-
34+
plugin_name="${plugin##*/}"
35+
plugin_folder="$PLUGINS_FOLDER/$plugin_name"
36+
if [[ ! -d "$plugin_folder/.git" ]]; then
37+
echo "Cloning $plugin..."
5538
git clone --depth 1 "$plugin" "$plugin_folder"
56-
39+
fi
5740
done
5841

59-
nvim -u NONE -U NONE -N -i NONE -l tests/init.lua "$@"
42+
# Run tests
43+
echo "Running tests with Neovim..."
44+
nvim -u NONE -U NONE -N -i NONE -l tests/init.lua "$@"

lua/gitlab/job.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ M.run_job = function(endpoint, method, body, callback, on_error_callback)
1919
-- success message or error message and details from the Go server and run the on_error_callback
2020
-- (if supplied for the job).
2121
local stderr = {}
22+
2223
Job:new({
2324
command = "curl",
2425
args = args,

0 commit comments

Comments
 (0)