-
Notifications
You must be signed in to change notification settings - Fork 194
136 lines (118 loc) · 4.39 KB
/
test.yml
File metadata and controls
136 lines (118 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
neovim-version: ["stable", "nightly"]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- name: Setup Neovim
uses: rhysd/action-setup-vim@8e931b9954b19d4203d5caa5ff5521f3bc21dcc7 # v1.4.2
with:
neovim: true
version: ${{ matrix.neovim-version }}
- name: Setup Lua
uses: leafo/gh-actions-lua@8aace3457a2fcf3f3c4e9007ecc6b869ff6d74d6 # v11
with:
luaVersion: "5.1"
- name: Setup Luarocks
uses: leafo/gh-actions-luarocks@4c082a5fad45388feaeb0798dbd82dbd7dc65bca # v5
- name: Install dependencies
run: |
luarocks install luacheck
luarocks install busted
luarocks install luacov
luarocks install luacov-reporter-lcov
- name: Run Luacheck
run: luacheck lua/ tests/ --no-unused-args --no-max-line-length
- name: Run tests
run: |
chmod +x ./run_tests.sh
./run_tests.sh
- name: Generate coverage report
run: |
# Check if stats file exists (created by busted --coverage)
if [ -f "luacov.stats.out" ]; then
# Generate the regular luacov report
luacov
# Convert to lcov format if luacov-reporter-lcov is installed
if command -v luacov-reporter-lcov &> /dev/null; then
luacov-reporter-lcov
if [ -f "luacov.report.out.lcov" ]; then
cp luacov.report.out.lcov lcov.info
else
# Fallback if lcov format not generated
echo "Creating simple lcov.info from luacov.report.out"
{
echo "TN:"
grep -E "^Summary$" -A1000 luacov.report.out | grep -E "^[^ ].*:" | while read -r line; do
file=$(echo "$line" | cut -d':' -f1)
echo "SF:$file"
percent=$(echo "$line" | grep -oE "[0-9\.]+%" | tr -d '%')
if [ -n "$percent" ]; then
echo "DA:1,1"
echo "LF:1"
echo "LH:$percent"
fi
echo "end_of_record"
done
} > lcov.info
fi
else
echo "luacov-reporter-lcov not found, generating simple lcov.info"
{
echo "TN:"
grep -E "^Summary$" -A1000 luacov.report.out | grep -E "^[^ ].*:" | while read -r line; do
file=$(echo "$line" | cut -d':' -f1)
echo "SF:$file"
percent=$(echo "$line" | grep -oE "[0-9\.]+%" | tr -d '%')
if [ -n "$percent" ]; then
echo "DA:1,1"
echo "LF:1"
echo "LH:$percent"
fi
echo "end_of_record"
done
} > lcov.info
fi
else
echo "No coverage data found in luacov.stats.out"
touch lcov.info
fi
- name: Upload coverage report
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4
with:
files: ./lcov.info
fail_ci_if_error: false
integration-tests:
runs-on: ubuntu-latest
needs: unit-tests
strategy:
matrix:
neovim-version: ["stable"]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
persist-credentials: false
- name: Setup Neovim
uses: rhysd/action-setup-vim@8e931b9954b19d4203d5caa5ff5521f3bc21dcc7 # v1.4.2
with:
neovim: true
version: ${{ matrix.neovim-version }}
- name: Install test dependencies
run: |
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
ln -s "$(pwd)" ~/.local/share/nvim/site/pack/vendor/start/claudecode.nvim
- name: Run integration tests
run: |
nvim --headless -u tests/minimal_init.lua -c "lua require('plenary.test_harness').test_directory('tests/integration', {minimal_init = 'tests/minimal_init.lua'})"