-
Notifications
You must be signed in to change notification settings - Fork 196
151 lines (128 loc) Β· 5 KB
/
test.yml
File metadata and controls
151 lines (128 loc) Β· 5 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
# Cancel in-progress runs for pull requests when developers push
# additional changes
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
# Unit/component tests run under LuaJIT with a mocked vim global (busted), so
# they do not need a real Neovim binary β hence no neovim-version matrix here.
# Real-Neovim coverage lives in the integration-tests job below.
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
# Build deps: PUC Lua builds from source, and the test rocks compile C modules.
- name: Install build dependencies
run: |
sudo apt-get -o Acquire::Retries=3 update
sudo apt-get -o Acquire::Retries=3 install -y build-essential libreadline-dev unzip
- name: Set up mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
# Cache the rock tree (rebuilt from luarocks.org otherwise); a miss just rebuilds.
- name: Cache Lua test rocks
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: .luarocks
key: luarocks-${{ runner.os }}-${{ hashFiles('mise.toml') }}
- name: Install Lua test rocks
run: mise run setup
- name: Run luacheck
run: mise run check
- name: Run tests
run: mise run test
- name: Check formatting
run: mise run format-check
- name: Generate coverage report
run: |
if [ -f "luacov.stats.out" ]; then
mise exec -- luacov
echo "Creating 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
{
echo "## π Test Coverage Report"
echo ""
if [ -f "luacov.report.out" ]; then
overall_coverage=$(grep -E "Total.*%" luacov.report.out | grep -oE "[0-9]+\.[0-9]+%" | head -1)
if [ -n "$overall_coverage" ]; then
echo "**Overall Coverage: $overall_coverage**"
echo ""
fi
echo "| File | Coverage |"
echo "|------|----------|"
grep -E "^[^ ].*:" luacov.report.out | while read -r line; do
file=$(echo "$line" | cut -d':' -f1)
percent=$(echo "$line" | grep -oE "[0-9]+\.[0-9]+%" | head -1)
if [ -n "$percent" ]; then
# Add emoji based on coverage level
percent_num="${percent%.*}"
if [ "$percent_num" -ge 90 ]; then
emoji="π’"
elif [ "$percent_num" -ge 70 ]; then
emoji="π‘"
else
emoji="π΄"
fi
echo "| \`$file\` | $emoji $percent |"
fi
done
else
echo "β No coverage report generated"
fi
} >> "$GITHUB_STEP_SUMMARY"
else
{
echo "## π Test Coverage Report"
echo ""
echo "β No coverage data found - tests may not have run with coverage enabled"
} >> "$GITHUB_STEP_SUMMARY"
fi
integration-tests:
runs-on: ubuntu-latest
needs: unit-tests
strategy:
matrix:
neovim-version: ["stable"]
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
# Neovim here comes from action-setup-vim (matrix-driven), independent of
# the mise.toml neovim pin used for local dev.
- 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: ./scripts/run_integration_tests_individually.sh