Skip to content

Commit fe004ba

Browse files
venkatarenduchintalaVenkata Subramani Renduchintala
andauthored
docs(readme): add Tests section and local CI execution guide (#24)
Co-authored-by: Venkata Subramani Renduchintala <venkatarenduchintala@pm.me>
1 parent 8b33ff0 commit fe004ba

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,75 @@ Plugin-specific mappings live in `lua/plugins/configs/`. LSP mappings are define
3030
3131
<br>
3232
33+
# Tests
34+
35+
The `test/` directory contains a headless CI suite that runs inside the devcontainer image. All steps are orchestrated by `test/ci_validate.sh`.
36+
37+
## Test scripts
38+
39+
- **`test/ci_install_plugins.lua`** — boots lazy.nvim in headless mode and runs `lazy.sync()`. Fails with exit code 1 if lazy.nvim is not loadable or the sync step errors.
40+
41+
- **`test/ci_validate_lsp.lua`** — verifies the native LSP layer loads without errors:
42+
- `require("lsp")` succeeds (global capabilities set via `vim.lsp.config('*', {...})`)
43+
- `vim.lsp.config["*"]` contains the expected capabilities table
44+
- Spot-checks that each `after/lsp/<name>.lua` file was sourced by asserting `vim.lsp.config[name].settings` is present for: `gopls`, `lua_ls`, `rust_analyzer`, `yamlls`, `helm_ls`, `eslint`, `ansiblels`, `jsonnet_ls`
45+
46+
- **`test/install_parsers.lua`** — installs all treesitter parsers via `TSInstall!` in headless mode, then polls until all `.so` files appear on disk (timeout: 5 min). Fails if any parser times out.
47+
- Parsers: `go`, `terraform`, `hcl`, `yaml`, `bash`, `gotmpl`, `dockerfile`, `jsonnet`, `python`, `markdown`, `markdown_inline`
48+
49+
- **`test/validate_treesitter.lua`** — loads each parser against a real source fixture and calls `parser:parse()`. Fails if any parser cannot be loaded or produces no parse trees.
50+
51+
## Test fixtures
52+
53+
| File | Parser(s) tested |
54+
|------|-----------------|
55+
| `fixtures/hello.go` | `go` |
56+
| `fixtures/main.tf` | `terraform` |
57+
| `fixtures/deployment.yaml` | `yaml` |
58+
| `fixtures/script.sh` | `bash` |
59+
| `fixtures/helm_deployment.yaml` | `gotmpl` |
60+
| `fixtures/Dockerfile` | `dockerfile` |
61+
| `fixtures/dashboard.jsonnet` | `jsonnet` |
62+
| `fixtures/script.py` | `python` |
63+
| `fixtures/README.md` | `markdown`, `markdown_inline` |
64+
65+
<br>
66+
67+
# Running the CI pipeline locally
68+
69+
The GitHub Actions workflow (`.github/workflows/validate.yml`) builds the devcontainer image and mounts the repo into it. You can reproduce this locally in two ways.
70+
71+
## Option 1 — Direct Docker (recommended for this config)
72+
73+
The most reliable local approach, since the workflow uses Docker-in-Docker internally:
74+
75+
```bash
76+
# Build the devcontainer image
77+
docker build -f .devcontainer/Dockerfile -t nvim-config:ci .
78+
79+
# Run the full validation suite
80+
docker run --rm \
81+
-e CI=true \
82+
-v "$(pwd):/home/dev/.config/nvim:ro" \
83+
nvim-config:ci \
84+
bash /home/dev/.config/nvim/test/ci_validate.sh
85+
```
86+
87+
The `-e CI=true` flag skips heavy binary downloads (LSP servers, DAP adapters) so the run completes in under 5 minutes.
88+
89+
## Option 2 — [act](https://github.com/nektos/act)
90+
91+
[act](https://github.com/nektos/act) runs GitHub Actions workflows locally using Docker. Install it via your package manager, then:
92+
93+
```bash
94+
# Run the validate job (mirrors what GitHub runs on push/PR)
95+
act push -j validate
96+
```
97+
98+
> **Note:** Because the workflow itself uses `docker/build-push-action`, `act` requires Docker-in-Docker. If the build step fails, fall back to Option 1 above.
99+
100+
<br>
101+
33102
# Featured Plugins
34103

35104
## LSP — Core Infrastructure

0 commit comments

Comments
 (0)