Skip to content

Commit e0df34d

Browse files
authored
Add comprehensive testing and CI setup (#1)
* Add comprehensive testing and CI setup - Add plenary.nvim test suite with 9 test cases covering all plugin functionality - Add GitHub Actions CI testing Neovim v0.8, v0.9, v0.10, stable, and nightly - Add Makefile with development commands (test, lint, format, install, health) - Add stylua code formatting with proper configuration - Use hash-pinned GitHub Actions for security - Test coverage: plugin loading, filetype detection, tree-sitter, otter.nvim, health checks * Fix GitHub Actions workflow YAML syntax - Fix missing indentation for checkout action uses statements - Resolves workflow validation errors on lines 32 and 54 * Fix Lua version in CI to use 5.4 - Change from non-existent Lua 5.5 to available Lua 5.4 - Resolves CI failure due to invalid Lua version * Change Lua version to 5.3 for stylua compatibility - Use Lua 5.3 which has better luarocks package availability - Should resolve stylua installation issue in CI lint job * Fix Neovim version tags to use exact releases - Use v0.8.3, v0.9.5, v0.10.3 instead of non-existent v0.8, v0.9, v0.10 tags - These are actual git tags that exist in neovim/neovim repository - Resolves CI failure where setup-neovim-action couldn't find the tags * Replace luarocks stylua with official stylua-action - Use JohnnyMorganz/stylua-action@479972f (v4.1.0) - Remove unnecessary Lua/Luarocks setup steps for linting job - Hash-pinned for security and uses official action with better caching - Resolves stylua installation issues with luarocks compatibility * Update minimum Neovim version requirement to 0.9+ - Remove v0.8.3 from CI matrix due to compatibility issues with dependencies - Update documentation to reflect Neovim 0.9+ requirement - nvim-treesitter and otter.nvim latest versions require newer Neovim APIs * Optimize CI matrix to use only tagged releases - Replace slow stable/nightly with fast tagged releases: v0.9.5, v0.10.4, v0.11.3 - Reduces CI time from 3+ minutes to 6-7 seconds per job - Covers minimum (0.9), stable (0.10), and latest (0.11) versions - Uses actual release tags for better reliability * Add stable and nightly back to CI matrix - Include stable and nightly versions now that they're cached - Provides comprehensive coverage: v0.9.5, v0.10.4, v0.11.3, stable, nightly - Tests against latest stable and cutting-edge development versions - Performance should be good now due to caching * Fix all inconsistencies and improve plugin reliability - Pin stylua to specific version v2.1.0 instead of 'latest' - Improve documentation clarity for otter.nvim installation step - Enhance health check to verify actual parser installation vs just configuration - Add test for otter.nvim activation in Arizona buffers - Fix Makefile dependency paths to match test expectations - All referenced repositories verified to exist and be functional
1 parent cbc4dda commit e0df34d

File tree

9 files changed

+374
-70
lines changed

9 files changed

+374
-70
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: CI
3+
4+
"on":
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- "*"
11+
workflow_dispatch: {}
12+
merge_group:
13+
14+
concurrency:
15+
group: ${{github.workflow}}-${{github.ref}}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
test:
20+
name: Test
21+
22+
runs-on: ubuntu-24.04
23+
24+
strategy:
25+
matrix:
26+
neovim-version: ['v0.9.5', 'v0.10.4', 'v0.11.3', 'stable', 'nightly']
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
31+
32+
- name: Setup Neovim
33+
uses: MunifTanjim/setup-neovim-action@5595675b7a0187e70489af966a26c43179d8ea5d # v1.1.0
34+
with:
35+
tag: ${{ matrix.neovim-version }}
36+
37+
- name: Setup dependencies
38+
run: make install
39+
40+
- name: Run tests
41+
run: make test
42+
43+
- name: Run health check
44+
run: make health
45+
46+
lint:
47+
name: Lint
48+
49+
runs-on: ubuntu-24.04
50+
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
54+
55+
- name: Check formatting with StyLua
56+
uses: JohnnyMorganz/stylua-action@479972f01e665acfcba96ada452c36608bdbbb5e # v4.1.0
57+
with:
58+
token: ${{ secrets.GITHUB_TOKEN }}
59+
version: v2.1.0
60+
args: --check .

Makefile

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.PHONY: test lint format clean install help
2+
3+
# Default target
4+
help:
5+
@echo "Available commands:"
6+
@echo " test - Run all tests"
7+
@echo " lint - Check code formatting"
8+
@echo " format - Format code with stylua"
9+
@echo " health - Run plugin health check"
10+
@echo " install - Install dependencies for local development"
11+
@echo " clean - Clean temporary files"
12+
@echo " help - Show this help message"
13+
14+
# Test the plugin
15+
test:
16+
@echo "Running tests..."
17+
nvim --headless --noplugin -u tests/minimal_init.lua \
18+
-c "lua require('plenary.test_harness').test_directory('tests')"
19+
20+
# Check code formatting
21+
lint:
22+
@echo "Checking code formatting..."
23+
stylua --check .
24+
25+
# Format code
26+
format:
27+
@echo "Formatting code..."
28+
stylua .
29+
30+
# Run health check
31+
health:
32+
@echo "Running health check..."
33+
nvim --headless -c "runtime! plugin/arizona.lua" -c "checkhealth arizona" -c "quit"
34+
35+
# Install development dependencies
36+
install:
37+
@echo "Installing development dependencies..."
38+
@mkdir -p ~/.local/share/nvim/site/pack/plenary/start
39+
@mkdir -p ~/.local/share/nvim/site/pack/treesitter/start
40+
@mkdir -p ~/.local/share/nvim/site/pack/otter/start
41+
@if [ ! -d ~/.local/share/nvim/site/pack/plenary/start/plenary.nvim ]; then \
42+
echo "Installing plenary.nvim..."; \
43+
git clone https://github.com/nvim-lua/plenary.nvim \
44+
~/.local/share/nvim/site/pack/plenary/start/plenary.nvim; \
45+
fi
46+
@if [ ! -d ~/.local/share/nvim/site/pack/treesitter/start/nvim-treesitter ]; then \
47+
echo "Installing nvim-treesitter..."; \
48+
git clone https://github.com/nvim-treesitter/nvim-treesitter \
49+
~/.local/share/nvim/site/pack/treesitter/start/nvim-treesitter; \
50+
fi
51+
@if [ ! -d ~/.local/share/nvim/site/pack/otter/start/otter.nvim ]; then \
52+
echo "Installing otter.nvim..."; \
53+
git clone https://github.com/jmbuhr/otter.nvim \
54+
~/.local/share/nvim/site/pack/otter/start/otter.nvim; \
55+
fi
56+
@echo "Dependencies installed!"
57+
58+
# Clean temporary files
59+
clean:
60+
@echo "Cleaning temporary files..."
61+
@find . -name "*.tmp" -delete
62+
@find . -name ".DS_Store" -delete
63+
@echo "Clean complete!"
64+
65+
# CI target (used by GitHub Actions)
66+
ci: lint test health

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use {
4747

4848
2. **Install otter.nvim** (for HTML/Erlang completion in template files):
4949
```
50-
Already listed as dependency above
50+
Include jmbuhr/otter.nvim in your plugin manager dependencies
5151
```
5252

5353
3. **Check everything is working**:
@@ -57,7 +57,7 @@ use {
5757

5858
## Requirements
5959

60-
- Neovim 0.8+
60+
- Neovim 0.9+
6161
- nvim-treesitter (required dependency)
6262
- otter.nvim (optional, for language injection)
6363

doc/arizona.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
*arizona.txt* Arizona Framework Language Support for Neovim
22

33
ARIZONA FRAMEWORK PLUGIN
4-
For Neovim 0.8+
4+
For Neovim 0.9+
55

66
==============================================================================
77
CONTENTS *arizona-contents*

lua/arizona/health.lua

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,51 @@
33
local M = {}
44

55
function M.check()
6-
local health = vim.health
7-
8-
health.start("Arizona Framework")
9-
10-
-- Core feature: Filetype detection (always works)
11-
if vim.filetype.match({ filename = "test.herl" }) == "arizona" then
12-
health.ok("Filetype detection working (.herl → arizona)")
13-
else
14-
health.error("Filetype detection broken")
15-
end
16-
17-
-- Feature: Tree-sitter parser
18-
local ts_ok, parsers = pcall(require, "nvim-treesitter.parsers")
19-
if ts_ok then
20-
if parsers.get_parser_configs().arizona then
21-
health.ok("Tree-sitter parser configured")
22-
else
23-
health.error("Tree-sitter parser not configured")
24-
end
25-
else
26-
health.warn("nvim-treesitter not available")
27-
end
28-
29-
-- Feature: Language injection
30-
if pcall(require, "otter") then
31-
health.ok("Language injection available (otter.nvim found)")
32-
else
33-
health.warn("Language injection unavailable (install otter.nvim)")
34-
end
35-
36-
-- Current buffer status
37-
local current_ft = vim.bo.filetype
38-
if current_ft == "arizona" then
39-
health.start("Current Buffer")
40-
health.ok("Current buffer is Arizona template file")
41-
end
6+
local health = vim.health
7+
8+
health.start("Arizona Framework")
9+
10+
-- Core feature: Filetype detection (always works)
11+
if vim.filetype.match({ filename = "test.herl" }) == "arizona" then
12+
health.ok("Filetype detection working (.herl → arizona)")
13+
else
14+
health.error("Filetype detection broken")
15+
end
16+
17+
-- Feature: Tree-sitter parser
18+
local ts_ok, parsers = pcall(require, "nvim-treesitter.parsers")
19+
if ts_ok then
20+
if parsers.get_parser_configs().arizona then
21+
health.ok("Tree-sitter parser configured")
22+
23+
-- Check if parser is actually installed
24+
local parser_ok =
25+
pcall(vim.treesitter.get_parser, vim.api.nvim_create_buf(false, true), "arizona")
26+
if parser_ok then
27+
health.ok("Arizona parser installed and working")
28+
else
29+
health.warn("Arizona parser configured but not installed - run :TSInstall arizona")
30+
end
31+
else
32+
health.error("Tree-sitter parser not configured")
33+
end
34+
else
35+
health.warn("nvim-treesitter not available")
36+
end
37+
38+
-- Feature: Language injection
39+
if pcall(require, "otter") then
40+
health.ok("Language injection available (otter.nvim found)")
41+
else
42+
health.warn("Language injection unavailable (install otter.nvim)")
43+
end
44+
45+
-- Current buffer status
46+
local current_ft = vim.bo.filetype
47+
if current_ft == "arizona" then
48+
health.start("Current Buffer")
49+
health.ok("Current buffer is Arizona template file")
50+
end
4251
end
4352

4453
return M
45-

plugin/arizona.lua

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,50 @@
33

44
-- Prevent double loading
55
if vim.g.arizona_loaded then
6-
return
6+
return
77
end
88
vim.g.arizona_loaded = 1
99

1010
-- Core feature: Filetype detection
1111
vim.filetype.add({
12-
extension = { herl = "arizona" },
12+
extension = { herl = "arizona" },
1313
})
1414

1515
-- Feature: Tree-sitter parser registration
1616
local function setup_treesitter()
17-
local ok, parser_config = pcall(require, "nvim-treesitter.parsers")
18-
if not ok then
19-
return
20-
end
21-
22-
local parsers = parser_config.get_parser_configs()
23-
parsers.arizona = {
24-
install_info = {
25-
url = "https://github.com/arizona-framework/tree-sitter-arizona",
26-
files = { "src/parser.c" },
27-
branch = "main",
28-
},
29-
filetype = "arizona",
30-
}
17+
local ok, parser_config = pcall(require, "nvim-treesitter.parsers")
18+
if not ok then
19+
return
20+
end
21+
22+
local parsers = parser_config.get_parser_configs()
23+
parsers.arizona = {
24+
install_info = {
25+
url = "https://github.com/arizona-framework/tree-sitter-arizona",
26+
files = { "src/parser.c" },
27+
branch = "main",
28+
},
29+
filetype = "arizona",
30+
}
3131
end
3232

3333
-- Feature: Language injection via otter.nvim
3434
local function setup_language_injection()
35-
local ok, otter = pcall(require, "otter")
36-
if not ok then
37-
return
38-
end
39-
40-
-- Auto-activate on Arizona files
41-
vim.api.nvim_create_autocmd("FileType", {
42-
pattern = "arizona",
43-
group = vim.api.nvim_create_augroup("ArizonaLanguageInjection", { clear = true }),
44-
callback = function()
45-
otter.activate({ "html", "erlang" }, true)
46-
end,
47-
})
35+
local ok, otter = pcall(require, "otter")
36+
if not ok then
37+
return
38+
end
39+
40+
-- Auto-activate on Arizona files
41+
vim.api.nvim_create_autocmd("FileType", {
42+
pattern = "arizona",
43+
group = vim.api.nvim_create_augroup("ArizonaLanguageInjection", { clear = true }),
44+
callback = function()
45+
otter.activate({ "html", "erlang" }, true)
46+
end,
47+
})
4848
end
4949

5050
-- Auto-setup all features
5151
setup_treesitter()
5252
setup_language_injection()
53-

stylua.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
indent_type = "Spaces"
2+
indent_width = 2
3+
column_width = 100
4+
line_endings = "Unix"
5+
quote_style = "AutoPreferDouble"
6+
call_parentheses = "Always"

0 commit comments

Comments
 (0)