Skip to content

Commit ea1d770

Browse files
authored
test: add tests for all tools (#76)
* test: add tests for all remaining tools Problem: most formatters and linters in guard-collection had no test coverage. The csharpier binary was renamed in v1.0+ and ruff's -e flag was deprecated in favor of the check subcommand. Solution: add 42 test files covering every remaining tool, fix the csharpier and ruff definitions, extend the install script with gz/jar archive types, add 6 new CI jobs (dotnet, ruby, clojure, elixir, nix, swift), and expand existing jobs with newly tested tools. * fix(ci): remove duplicate entry and untestable mypyc test * fix(ci): restore CI config lost during merge Problem: the -X theirs merge strategy replaced the full test/all-tools CI config with the smaller fix/broken-configs version, losing install entries for dart, fish_indent, google-java-format, pg_format, tombi, typos, typstyle, xmllint, and zigfmt. Solution: restore binary.txt, ci.yaml, and install script from the pre-merge test/all-tools state which already had all entries. * ci: extract repeated test setup into composite action Problem: every test job repeated the same 5 steps for neovim, lua, luarocks, busted/nlua, and guard.nvim clone — 175 lines of duplication across 15 jobs. Solution: extract into .github/actions/test-setup/action.yml and replace with a single `uses: ./.github/actions/test-setup` per job. * fix(test): use run_lint/run_fmt instead of manual vim.system Problem: rebase picked up old test versions that manually construct commands instead of using the config-driven helpers, defeating the purpose of testing the actual tool definitions. Solution: replace all 14 affected test files with the upstream/main versions that use run_lint/run_fmt. Add buf lint test using run_lint. * ci(cljfmt): use standalone binary and extract apt packages to file Problem: cljfmt required a dedicated CI job with Java, Clojure CLI, a hand-rolled wrapper script, and dep pre-warming. The binary job also had an inline apt-get install command inconsistent with other tool lists. Solution: switch cljfmt to the standalone GraalVM binary from GitHub releases, move its test into test/binary/, delete the test-clojure job, and extract the binary job's apt packages into binary-apt.txt. * ci: retrigger * ci: retrigger * ci: re-trigger * fix(rubocop): use rubocop directly instead of bundle exec Problem: rubocop formatter and linter definitions used `bundle exec rubocop`, requiring a Gemfile and bundle install in both tests and CI. Solution: invoke rubocop directly via `gem install rubocop`. Remove Gemfile setup from test and CI.
1 parent 888962b commit ea1d770

39 files changed

Lines changed: 476 additions & 147 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Test Setup
2+
description: Install Neovim, Lua 5.1, Luarocks, busted, nlua, and guard.nvim
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- uses: rhysd/action-setup-vim@v1
8+
with:
9+
neovim: true
10+
version: nightly
11+
- uses: leso-kn/gh-actions-lua@master
12+
with:
13+
luaVersion: '5.1'
14+
- uses: hishamhm/gh-actions-luarocks@master
15+
- run: luarocks install busted --local && luarocks install nlua --local
16+
shell: bash
17+
- run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
18+
shell: bash

.github/scripts/install-binary-tools.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ while read -r name type url extra; do
3030
chmod +x "$dest/$name"
3131
rm -rf "$tmpdir"
3232
;;
33+
gz)
34+
wget -q "$url" -O "$dest/$name.gz"
35+
gunzip "$dest/$name.gz"
36+
chmod +x "$dest/$name"
37+
;;
3338
jar)
3439
wget -q "$url" -O "$dest/$name.jar"
35-
printf '#!/usr/bin/env bash\nexec java -jar "%s/%s.jar" "$@"\n' "$(cd "$dest" && pwd)" "$name" > "$dest/$name"
40+
printf '#!/bin/sh\njava -jar %s/%s.jar "$@"\n' "$dest" "$name" > "$dest/$name"
3641
chmod +x "$dest/$name"
3742
;;
3843
esac

.github/tools/binary-apt.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fish
2+
jq
3+
libxml2-utils
4+
pgformatter
5+
shellcheck
6+
zsh

.github/tools/binary.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
alejandra bin https://github.com/kamadorueda/alejandra/releases/download/4.0.0/alejandra-x86_64-unknown-linux-musl
22
buf bin https://github.com/bufbuild/buf/releases/download/v1.47.2/buf-Linux-x86_64
3-
hadolint bin https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
3+
cbfmt tar https://github.com/lukas-reineke/cbfmt/releases/download/v0.2.0/cbfmt_linux-x86_64_v0.2.0.tar.gz cbfmt_linux-x86_64_v0.2.0/cbfmt
44
checkmake bin https://github.com/mrtazz/checkmake/releases/download/0.2.2/checkmake-0.2.2.linux.amd64
5+
cljfmt tar https://github.com/weavejester/cljfmt/releases/download/0.15.6/cljfmt-0.15.6-linux-amd64-static.tar.gz cljfmt
56
deno zip https://github.com/denoland/deno/releases/download/v2.1.4/deno-x86_64-unknown-linux-gnu.zip
67
detekt jar https://github.com/detekt/detekt/releases/download/v1.23.7/detekt-cli-1.23.7-all.jar
8+
dprint zip https://github.com/dprint/dprint/releases/download/0.49.0/dprint-x86_64-unknown-linux-gnu.zip
9+
google-java-format jar https://github.com/google/google-java-format/releases/download/v1.34.1/google-java-format-1.34.1-all-deps.jar
10+
hadolint bin https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
711
hlint tar https://github.com/ndmitchell/hlint/releases/download/v3.10/hlint-3.10-x86_64-linux.tar.gz hlint-3.10/hlint
12+
ktfmt jar https://repo1.maven.org/maven2/com/facebook/ktfmt/0.52/ktfmt-0.52-jar-with-dependencies.jar
13+
ktlint bin https://github.com/pinterest/ktlint/releases/download/1.8.0/ktlint
814
latexindent bin https://github.com/cmhughes/latexindent.pl/releases/download/V3.24.4/latexindent-linux
15+
ormolu zip https://github.com/tweag/ormolu/releases/download/0.8.0.2/ormolu-x86_64-linux.zip
16+
shfmt bin https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_linux_amd64
917
swiftformat zip https://github.com/nicklockwood/SwiftFormat/releases/download/0.55.3/swiftformat_linux.zip swiftformat_linux
10-
cbfmt tar https://github.com/lukas-reineke/cbfmt/releases/download/v0.2.0/cbfmt_linux-x86_64_v0.2.0.tar.gz cbfmt_linux-x86_64_v0.2.0/cbfmt
11-
dprint zip https://github.com/dprint/dprint/releases/download/0.49.0/dprint-x86_64-unknown-linux-gnu.zip
12-
ktlint bin https://github.com/pinterest/ktlint/releases/download/1.8.0/ktlint
18+
tombi gz https://github.com/tombi-toml/tombi/releases/download/v0.7.27/tombi-cli-0.7.27-x86_64-unknown-linux-musl.gz
19+
typos tar https://github.com/crate-ci/typos/releases/download/v1.43.3/typos-v1.43.3-x86_64-unknown-linux-musl.tar.gz ./typos
20+
typstyle bin https://github.com/typstyle-rs/typstyle/releases/download/v0.14.4/typstyle-x86_64-unknown-linux-gnu

.github/tools/go.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
golang.org/x/tools/cmd/goimports@latest
12
mvdan.cc/gofumpt@latest
23
github.com/segmentio/golines@latest
4+
github.com/google/yamlfmt/cmd/yamlfmt@latest

.github/tools/npm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
prettier
2+
@fsouza/prettierd
23
@biomejs/biome
34
sql-formatter
45
@taplo/cli

.github/tools/pip.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
autopep8
22
black
33
cmake-format
4+
codespell
45
cpplint
6+
djhtml
57
docformatter
68
flake8
9+
isort
10+
mdformat
711
mypy
812
pylint
913
ruff
1014
sqlfluff
15+
yamlfix
1116
yapf

.github/workflows/ci.yaml

Lines changed: 57 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,12 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v4
24-
- uses: rhysd/action-setup-vim@v1
25-
with:
26-
neovim: true
27-
version: nightly
24+
- uses: ./.github/actions/test-setup
2825
- uses: actions/setup-python@v5
2926
with:
3027
python-version: '3.12'
31-
- uses: leso-kn/gh-actions-lua@master
32-
with:
33-
luaVersion: "5.1"
34-
- uses: hishamhm/gh-actions-luarocks@master
3528
- name: Install tools
36-
run: |
37-
pip install -q -r .github/tools/pip.txt
38-
luarocks install busted --local
39-
luarocks install nlua --local
40-
- name: Clone guard.nvim
41-
run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
29+
run: pip install -q -r .github/tools/pip.txt
4230
- name: Run tests
4331
run: |
4432
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -48,24 +36,12 @@ jobs:
4836
runs-on: ubuntu-latest
4937
steps:
5038
- uses: actions/checkout@v4
51-
- uses: rhysd/action-setup-vim@v1
52-
with:
53-
neovim: true
54-
version: nightly
39+
- uses: ./.github/actions/test-setup
5540
- uses: actions/setup-node@v4
5641
with:
5742
node-version: 20
58-
- uses: leso-kn/gh-actions-lua@master
59-
with:
60-
luaVersion: "5.1"
61-
- uses: hishamhm/gh-actions-luarocks@master
6243
- name: Install tools
63-
run: |
64-
xargs npm install -g < .github/tools/npm.txt
65-
luarocks install busted --local
66-
luarocks install nlua --local
67-
- name: Clone guard.nvim
68-
run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
44+
run: xargs npm install -g < .github/tools/npm.txt
6945
- name: Run tests
7046
run: |
7147
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -75,26 +51,15 @@ jobs:
7551
runs-on: ubuntu-latest
7652
steps:
7753
- uses: actions/checkout@v4
78-
- uses: rhysd/action-setup-vim@v1
79-
with:
80-
neovim: true
81-
version: nightly
54+
- uses: ./.github/actions/test-setup
8255
- uses: actions/setup-go@v5
8356
with:
8457
go-version: stable
8558
cache: false
86-
- uses: leso-kn/gh-actions-lua@master
87-
with:
88-
luaVersion: "5.1"
89-
- uses: hishamhm/gh-actions-luarocks@master
9059
- name: Install tools
9160
run: |
9261
xargs -L1 go install < .github/tools/go.txt
9362
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8
94-
luarocks install busted --local
95-
luarocks install nlua --local
96-
- name: Clone guard.nvim
97-
run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
9863
- name: Run tests
9964
run: |
10065
export PATH="$HOME/go/bin:$PATH"
@@ -105,26 +70,13 @@ jobs:
10570
runs-on: ubuntu-latest
10671
steps:
10772
- uses: actions/checkout@v4
108-
- uses: rhysd/action-setup-vim@v1
109-
with:
110-
neovim: true
111-
version: nightly
73+
- uses: ./.github/actions/test-setup
11274
- uses: dtolnay/rust-toolchain@stable
11375
with:
11476
components: rustfmt
11577
- uses: dtolnay/rust-toolchain@nightly
11678
with:
11779
components: rustfmt
118-
- uses: leso-kn/gh-actions-lua@master
119-
with:
120-
luaVersion: "5.1"
121-
- uses: hishamhm/gh-actions-luarocks@master
122-
- name: Install test tools
123-
run: |
124-
luarocks install busted --local
125-
luarocks install nlua --local
126-
- name: Clone guard.nvim
127-
run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
12880
- name: Run tests
12981
run: |
13082
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -134,22 +86,12 @@ jobs:
13486
runs-on: ubuntu-latest
13587
steps:
13688
- uses: actions/checkout@v4
137-
- uses: rhysd/action-setup-vim@v1
138-
with:
139-
neovim: true
140-
version: nightly
141-
- uses: leso-kn/gh-actions-lua@master
142-
with:
143-
luaVersion: "5.1"
144-
- uses: hishamhm/gh-actions-luarocks@master
89+
- uses: ./.github/actions/test-setup
14590
- name: Install tools
14691
run: |
147-
luarocks install busted --local
148-
luarocks install nlua --local
14992
luarocks install luacheck --local
93+
luarocks install fnlfmt --local
15094
bash .github/scripts/install-binary-tools.sh "$HOME/.local/bin" .github/tools/lua-binary.txt
151-
- name: Clone guard.nvim
152-
run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
15395
- name: Run tests
15496
run: |
15597
export PATH="$HOME/.local/bin:$PATH"
@@ -160,26 +102,19 @@ jobs:
160102
runs-on: ubuntu-latest
161103
steps:
162104
- uses: actions/checkout@v4
163-
- uses: rhysd/action-setup-vim@v1
105+
- uses: ./.github/actions/test-setup
106+
- uses: dart-lang/setup-dart@v1
107+
- uses: mlugg/setup-zig@v2
164108
with:
165-
neovim: true
166-
version: nightly
109+
version: 0.15.2
167110
- uses: actions/setup-java@v4
168111
with:
169112
distribution: temurin
170113
java-version: 21
171-
- uses: leso-kn/gh-actions-lua@master
172-
with:
173-
luaVersion: "5.1"
174-
- uses: hishamhm/gh-actions-luarocks@master
175114
- name: Install tools
176115
run: |
177-
sudo apt-get install -y zsh shellcheck
178-
luarocks install busted --local
179-
luarocks install nlua --local
116+
xargs sudo apt-get install -y < .github/tools/binary-apt.txt
180117
bash .github/scripts/install-binary-tools.sh "$HOME/.local/bin"
181-
- name: Clone guard.nvim
182-
run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
183118
- name: Run tests
184119
run: |
185120
export PATH="$HOME/.local/bin:$PATH"
@@ -190,21 +125,9 @@ jobs:
190125
runs-on: ubuntu-latest
191126
steps:
192127
- uses: actions/checkout@v4
193-
- uses: rhysd/action-setup-vim@v1
194-
with:
195-
neovim: true
196-
version: nightly
197-
- uses: leso-kn/gh-actions-lua@master
198-
with:
199-
luaVersion: "5.1"
200-
- uses: hishamhm/gh-actions-luarocks@master
128+
- uses: ./.github/actions/test-setup
201129
- name: Install tools
202-
run: |
203-
xargs sudo apt-get install -y < .github/tools/apt.txt
204-
luarocks install busted --local
205-
luarocks install nlua --local
206-
- name: Clone guard.nvim
207-
run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
130+
run: xargs sudo apt-get install -y < .github/tools/apt.txt
208131
- name: Run tests
209132
run: |
210133
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -214,24 +137,12 @@ jobs:
214137
runs-on: ubuntu-latest
215138
steps:
216139
- uses: actions/checkout@v4
217-
- uses: rhysd/action-setup-vim@v1
218-
with:
219-
neovim: true
220-
version: nightly
140+
- uses: ./.github/actions/test-setup
221141
- uses: actions/setup-dotnet@v4
222142
with:
223143
dotnet-version: '8.0'
224-
- uses: leso-kn/gh-actions-lua@master
225-
with:
226-
luaVersion: "5.1"
227-
- uses: hishamhm/gh-actions-luarocks@master
228144
- name: Install tools
229-
run: |
230-
dotnet tool install -g csharpier
231-
luarocks install busted --local
232-
luarocks install nlua --local
233-
- name: Clone guard.nvim
234-
run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
145+
run: dotnet tool install -g csharpier
235146
- name: Run tests
236147
run: |
237148
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
@@ -241,31 +152,53 @@ jobs:
241152
runs-on: ubuntu-latest
242153
steps:
243154
- uses: actions/checkout@v4
244-
- uses: rhysd/action-setup-vim@v1
245-
with:
246-
neovim: true
247-
version: nightly
155+
- uses: ./.github/actions/test-setup
248156
- uses: ruby/setup-ruby@v1
249157
with:
250158
ruby-version: '3.3'
251-
- uses: leso-kn/gh-actions-lua@master
252-
with:
253-
luaVersion: "5.1"
254-
- uses: hishamhm/gh-actions-luarocks@master
255159
- name: Install tools
160+
run: gem install rubocop
161+
- name: Run tests
256162
run: |
257-
gem install rubocop bundler
258-
luarocks install busted --local
259-
luarocks install nlua --local
260-
- name: Setup rubocop Gemfile
163+
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
164+
busted --lua nlua test/ruby/*_spec.lua
165+
166+
test-elixir:
167+
runs-on: ubuntu-latest
168+
steps:
169+
- uses: actions/checkout@v4
170+
- uses: ./.github/actions/test-setup
171+
- uses: erlef/setup-beam@v1
172+
with:
173+
otp-version: '27'
174+
elixir-version: '1.17'
175+
- name: Run tests
261176
run: |
262-
mkdir -p /tmp/rubocop-test
263-
printf "source 'https://rubygems.org'\ngem 'rubocop'\n" > /tmp/rubocop-test/Gemfile
264-
cd /tmp/rubocop-test && bundle install
265-
- name: Clone guard.nvim
266-
run: git clone --depth 1 https://github.com/nvimdev/guard.nvim && mv guard.nvim/lua/guard lua/
177+
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
178+
busted --lua nlua test/elixir/*_spec.lua
179+
180+
test-nix:
181+
runs-on: ubuntu-latest
182+
steps:
183+
- uses: actions/checkout@v4
184+
- uses: ./.github/actions/test-setup
185+
- uses: cachix/install-nix-action@v27
186+
- name: Install tools
187+
run: nix profile install nixpkgs#nixfmt-rfc-style
267188
- name: Run tests
268189
run: |
269190
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
270-
busted --lua nlua test/ruby/*_spec.lua
191+
busted --lua nlua test/nix/*_spec.lua
271192
193+
test-swift:
194+
runs-on: ubuntu-latest
195+
steps:
196+
- uses: actions/checkout@v4
197+
- uses: ./.github/actions/test-setup
198+
- uses: swift-actions/setup-swift@v2
199+
with:
200+
swift-version: '6.0'
201+
- name: Run tests
202+
run: |
203+
export LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
204+
busted --lua nlua test/swift/*_spec.lua

0 commit comments

Comments
 (0)