9
9
permissions :
10
10
contents : read
11
11
12
+ # Cancel in-progress runs for pull requests when developers push
13
+ # additional changes
14
+ concurrency :
15
+ group : ${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
17
+
12
18
jobs :
13
19
unit-tests :
14
20
runs-on : ubuntu-latest
@@ -17,86 +23,63 @@ jobs:
17
23
neovim-version : ["stable", "nightly"]
18
24
19
25
steps :
20
- - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
26
+ - name : Checkout
27
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21
28
with :
29
+ fetch-depth : 0
22
30
persist-credentials : false
23
31
32
+ - name : Setup Nix
33
+ uses : nixbuild/nix-quick-install-action@5bb6a3b3abe66fd09bbf250dce8ada94f856a703 # v30
34
+
35
+ - uses : nix-community/cache-nix-action@135667ec418502fa5a3598af6fb9eb733888ce6a # v6.1.3
36
+ with :
37
+ primary-key : nix-claudecode-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
38
+ restore-prefixes-first-match : nix-claudecode-${{ runner.os }}-
39
+ gc-max-store-size-linux : 2G
40
+ purge : true
41
+ purge-prefixes : nix-claudecode-${{ runner.os }}-
42
+ purge-created : 0
43
+ purge-primary-key : never
44
+
24
45
- name : Setup Neovim
25
46
uses : rhysd/action-setup-vim@8e931b9954b19d4203d5caa5ff5521f3bc21dcc7 # v1.4.2
26
47
with :
27
48
neovim : true
28
49
version : ${{ matrix.neovim-version }}
29
50
30
- - name : Setup Lua
31
- uses : leafo/gh-actions-lua@8aace3457a2fcf3f3c4e9007ecc6b869ff6d74d6 # v11
32
- with :
33
- luaVersion : " 5.1"
34
-
35
- - name : Setup Luarocks
36
- uses : leafo/gh-actions-luarocks@4c082a5fad45388feaeb0798dbd82dbd7dc65bca # v5
37
-
38
- - name : Install dependencies
39
- run : |
40
- luarocks install luacheck
41
- luarocks install busted
42
- luarocks install luacov
43
- luarocks install luacov-reporter-lcov
44
-
45
51
- name : Run Luacheck
46
- run : luacheck lua/ tests/ --no-unused-args --no-max-line-length
52
+ run : nix develop .#ci -c luacheck lua/ tests/ --no-unused-args --no-max-line-length
47
53
48
54
- name : Run tests
49
- run : |
50
- chmod +x ./run_tests.sh
51
- ./run_tests.sh
55
+ run : nix develop .#ci -c ./run_tests.sh
56
+
57
+ - name : Check formatting
58
+ run : nix flake check
52
59
53
60
- name : Generate coverage report
54
61
run : |
55
62
# Check if stats file exists (created by busted --coverage)
56
63
if [ -f "luacov.stats.out" ]; then
57
64
# Generate the regular luacov report
58
- luacov
59
-
60
- # Convert to lcov format if luacov-reporter-lcov is installed
61
- if command -v luacov-reporter-lcov &> /dev/null; then
62
- luacov-reporter-lcov
63
- if [ -f "luacov.report.out.lcov" ]; then
64
- cp luacov.report.out.lcov lcov.info
65
- else
66
- # Fallback if lcov format not generated
67
- echo "Creating simple lcov.info from luacov.report.out"
68
- {
69
- echo "TN:"
70
- grep -E "^Summary$" -A1000 luacov.report.out | grep -E "^[^ ].*:" | while read -r line; do
71
- file=$(echo "$line" | cut -d':' -f1)
72
- echo "SF:$file"
73
- percent=$(echo "$line" | grep -oE "[0-9\.]+%" | tr -d '%')
74
- if [ -n "$percent" ]; then
75
- echo "DA:1,1"
76
- echo "LF:1"
77
- echo "LH:$percent"
78
- fi
79
- echo "end_of_record"
80
- done
81
- } > lcov.info
82
- fi
83
- else
84
- echo "luacov-reporter-lcov not found, generating simple lcov.info"
85
- {
86
- echo "TN:"
87
- grep -E "^Summary$" -A1000 luacov.report.out | grep -E "^[^ ].*:" | while read -r line; do
88
- file=$(echo "$line" | cut -d':' -f1)
89
- echo "SF:$file"
90
- percent=$(echo "$line" | grep -oE "[0-9\.]+%" | tr -d '%')
91
- if [ -n "$percent" ]; then
92
- echo "DA:1,1"
93
- echo "LF:1"
94
- echo "LH:$percent"
95
- fi
96
- echo "end_of_record"
97
- done
98
- } > lcov.info
99
- fi
65
+ nix develop .#ci -c luacov
66
+
67
+ # Create simple lcov.info from luacov.report.out
68
+ echo "Creating lcov.info from luacov.report.out"
69
+ {
70
+ echo "TN:"
71
+ grep -E "^Summary$" -A1000 luacov.report.out | grep -E "^[^ ].*:" | while read -r line; do
72
+ file=$(echo "$line" | cut -d':' -f1)
73
+ echo "SF:$file"
74
+ percent=$(echo "$line" | grep -oE "[0-9\.]+%" | tr -d '%')
75
+ if [ -n "$percent" ]; then
76
+ echo "DA:1,1"
77
+ echo "LF:1"
78
+ echo "LH:$percent"
79
+ fi
80
+ echo "end_of_record"
81
+ done
82
+ } > lcov.info
100
83
else
101
84
echo "No coverage data found in luacov.stats.out"
102
85
touch lcov.info
@@ -116,10 +99,25 @@ jobs:
116
99
neovim-version : ["stable"]
117
100
118
101
steps :
119
- - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
102
+ - name : Checkout
103
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
120
104
with :
105
+ fetch-depth : 0
121
106
persist-credentials : false
122
107
108
+ - name : Setup Nix
109
+ uses : nixbuild/nix-quick-install-action@5bb6a3b3abe66fd09bbf250dce8ada94f856a703 # v30
110
+
111
+ - uses : nix-community/cache-nix-action@135667ec418502fa5a3598af6fb9eb733888ce6a # v6.1.3
112
+ with :
113
+ primary-key : nix-claudecode-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
114
+ restore-prefixes-first-match : nix-claudecode-${{ runner.os }}-
115
+ gc-max-store-size-linux : 2G
116
+ purge : true
117
+ purge-prefixes : nix-claudecode-${{ runner.os }}-
118
+ purge-created : 0
119
+ purge-primary-key : never
120
+
123
121
- name : Setup Neovim
124
122
uses : rhysd/action-setup-vim@8e931b9954b19d4203d5caa5ff5521f3bc21dcc7 # v1.4.2
125
123
with :
@@ -132,5 +130,4 @@ jobs:
132
130
ln -s "$(pwd)" ~/.local/share/nvim/site/pack/vendor/start/claudecode.nvim
133
131
134
132
- name : Run integration tests
135
- run : |
136
- nvim --headless -u tests/minimal_init.lua -c "lua require('plenary.test_harness').test_directory('tests/integration', {minimal_init = 'tests/minimal_init.lua'})"
133
+ run : nix develop .#ci -c nvim --headless -u tests/minimal_init.lua -c "lua require('plenary.test_harness').test_directory('tests/integration', {minimal_init = 'tests/minimal_init.lua'})"
0 commit comments