Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
status:
project:
default:
informational: true
only_pulls: true
patch:
default:
informational: true
only_pulls: true
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,32 @@ jobs:
mv nvim.appimage ./build/nvim
}

- name: Get Luver Cache Key
id: luver-cache-key
env:
CI_RUNNER_OS: ${{ runner.os }}
run: |
echo "::set-output name=value::${CI_RUNNER_OS}-luver-v1-$(date -u +%Y-%m-%d)"
shell: bash
- name: Setup Luver Cache
uses: actions/cache@v2
with:
path: ~/.local/share/luver
key: ${{ steps.luver-cache-key.outputs.value }}
- name: Setup Lua
uses: MunifTanjim/luver-action@v1
with:
default: 5.1.5
lua_versions: 5.1.5
luarocks_versions: 5.1.5:3.8.0
- name: Setup luacov
run: |
luarocks install luacov

- name: Run tests
run: |
export PATH="${PWD}/build/:${PATH}"
./scripts/test.sh

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ tags

# Others
.testcache
luacov.*.out
3 changes: 3 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include = {
"lua%/neo%-tree",
}
29 changes: 29 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -euo pipefail

luacov_dir=""

while [[ $# -gt 0 ]]; do
case "${1}" in
--clean)
Expand Down Expand Up @@ -36,6 +38,8 @@ function setup_environment() {
if [[ ! -d "${plugins_dir}/plenary.nvim" ]]; then
echo "[plugins] plenary.nvim: installing..."
git clone https://github.com/nvim-lua/plenary.nvim "${plugins_dir}/plenary.nvim"
# this commit broke luacov
git -C "${plugins_dir}/plenary.nvim" revert --no-commit 9069d14a120cadb4f6825f76821533f2babcab92
echo "[plugins] plenary.nvim: installed"
echo
fi
Expand All @@ -44,6 +48,31 @@ function setup_environment() {
echo
}

function luacov_start() {
luacov_dir="$(dirname "$(luarocks which luacov 2>/dev/null | head -1)")"
if [[ "${luacov_dir}" == "." ]]; then
luacov_dir=""
fi

if test -n "${luacov_dir}"; then
rm -f luacov.*.out
export LUA_PATH=";;${luacov_dir}/?.lua"
fi
}

function luacov_end() {
if test -n "${luacov_dir}"; then
luacov

echo
tail -n +$(($(grep -n "^Summary$" luacov.report.out | cut -d":" -f1) - 1)) luacov.report.out
fi
}

setup_environment

luacov_start

make test

luacov_end
2 changes: 2 additions & 0 deletions tests/neo-tree/command/command_current_spec.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pcall(require, "luacov")

local Path = require("plenary.path")
local util = require("tests.helpers.util")
local verify = require("tests.helpers.verify")
Expand Down
2 changes: 2 additions & 0 deletions tests/neo-tree/command/command_spec.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pcall(require, "luacov")

local util = require("tests.helpers.util")
local verify = require("tests.helpers.verify")
local config = require("neo-tree").config
Expand Down
2 changes: 2 additions & 0 deletions tests/neo-tree/sources/filesystem/filesystem_command_spec.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pcall(require, "luacov")

local util = require("tests.helpers.util")
local verify = require("tests.helpers.verify")
local config = require("neo-tree").config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pcall(require, "luacov")

local util = require("tests.helpers.util")
local verify = require("tests.helpers.verify")
local utils = require("neo-tree.utils")
Expand Down