Skip to content

Commit 86bed4f

Browse files
authored
ci: adopt nix flake and just-based quality checks (#15)
Brings http-codes.nvim in line with the rest of the Neovim plugin repos: - Adds flake.nix with the standard dev shell (just, stylua, prettier, selene, neovim, lua-language-server, vimdoc-language-server), using the nixpkgs-packaged vimdoc-language-server rather than a custom flake input. - Adds a justfile with format/lint/ci recipes (nix fmt, stylua, prettier, selene, lua-language-server, vimdoc-language-server) mirroring the shared pattern. - Replaces the multi-job quality workflow with a single Quality job that runs `just format` and `just lint` inside the ci dev shell, and drops the now-redundant ci.yaml workflow.
1 parent 90a9a4a commit 86bed4f

5 files changed

Lines changed: 113 additions & 138 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/quality.yaml

Lines changed: 7 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -7,83 +7,13 @@ on:
77
branches: [main]
88

99
jobs:
10-
changes:
10+
quality:
11+
name: Quality
1112
runs-on: ubuntu-latest
12-
outputs:
13-
lua: ${{ steps.changes.outputs.lua }}
14-
markdown: ${{ steps.changes.outputs.markdown }}
1513
steps:
1614
- uses: actions/checkout@v4
17-
- uses: dorny/paths-filter@v3
18-
id: changes
19-
with:
20-
filters: |
21-
lua:
22-
- 'lua/**'
23-
- 'plugin/**'
24-
- '*.lua'
25-
- '.luarc.json'
26-
- '*.toml'
27-
markdown:
28-
- '*.md'
29-
- 'doc/**/*.md'
30-
31-
lua-format:
32-
name: Lua Format Check
33-
runs-on: ubuntu-latest
34-
needs: changes
35-
if: ${{ needs.changes.outputs.lua == 'true' }}
36-
steps:
37-
- uses: actions/checkout@v4
38-
- uses: JohnnyMorganz/stylua-action@v4
39-
with:
40-
token: ${{ secrets.GITHUB_TOKEN }}
41-
version: 2.1.0
42-
args: --check .
43-
44-
lua-lint:
45-
name: Lua Lint Check
46-
runs-on: ubuntu-latest
47-
needs: changes
48-
if: ${{ needs.changes.outputs.lua == 'true' }}
49-
steps:
50-
- uses: actions/checkout@v4
51-
- name: Lint with Selene
52-
uses: NTBBloodbath/selene-action@v1.0.0
53-
with:
54-
token: ${{ secrets.GITHUB_TOKEN }}
55-
args: --display-style quiet .
56-
57-
lua-typecheck:
58-
name: Lua Type Check
59-
runs-on: ubuntu-latest
60-
needs: changes
61-
if: ${{ needs.changes.outputs.lua == 'true' }}
62-
steps:
63-
- uses: actions/checkout@v4
64-
- name: Run Lua LS Type Check
65-
uses: mrcjkb/lua-typecheck-action@v0
66-
with:
67-
checklevel: Warning
68-
directories: lua
69-
configpath: .luarc.json
70-
71-
markdown-format:
72-
name: Markdown Format Check
73-
runs-on: ubuntu-latest
74-
needs: changes
75-
if: ${{ needs.changes.outputs.markdown == 'true' }}
76-
steps:
77-
- uses: actions/checkout@v4
78-
- name: Setup pnpm
79-
uses: pnpm/action-setup@v4
80-
with:
81-
version: 8
82-
- name: Setup Node.js
83-
uses: actions/setup-node@v4
84-
with:
85-
node-version: "20"
86-
- name: Install prettier
87-
run: pnpm add -g prettier@3.1.0
88-
- name: Check markdown formatting with prettier
89-
run: prettier --check .
15+
- uses: cachix/install-nix-action@v31
16+
- name: Format
17+
run: nix develop .#ci --command just format
18+
- name: Lint
19+
run: nix develop .#ci --command just lint

flake.lock

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
description = "http-codes.nvim — HTTP status code reference for Neovim";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
systems.url = "github:nix-systems/default";
7+
};
8+
9+
outputs =
10+
{
11+
nixpkgs,
12+
systems,
13+
...
14+
}:
15+
let
16+
forEachSystem =
17+
f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});
18+
in
19+
{
20+
formatter = forEachSystem (pkgs: pkgs.nixfmt-tree);
21+
22+
devShells = forEachSystem (pkgs: {
23+
default = pkgs.mkShell {
24+
packages = [
25+
pkgs.just
26+
pkgs.prettier
27+
pkgs.stylua
28+
pkgs.neovim
29+
pkgs.selene
30+
pkgs.lua-language-server
31+
pkgs.vimdoc-language-server
32+
];
33+
};
34+
35+
ci = pkgs.mkShell {
36+
packages = [
37+
pkgs.just
38+
pkgs.prettier
39+
pkgs.stylua
40+
pkgs.neovim
41+
pkgs.selene
42+
pkgs.lua-language-server
43+
pkgs.vimdoc-language-server
44+
];
45+
};
46+
});
47+
};
48+
}

justfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
default:
2+
@just --list
3+
4+
format:
5+
nix fmt -- --ci
6+
stylua --check .
7+
prettier --check .
8+
9+
lint:
10+
git ls-files '*.lua' | xargs selene --display-style quiet
11+
lua-language-server --check . --configpath "$(pwd)/.luarc.json" --checklevel=Warning
12+
vimdoc-language-server check doc/
13+
14+
ci: format lint
15+
@:

0 commit comments

Comments
 (0)