Skip to content

Commit

Permalink
build: add nix test + docgen infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Oct 20, 2023
1 parent 950256a commit 62360a2
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 11 deletions.
12 changes: 12 additions & 0 deletions .busted
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
return {
_all = {
coverage = false,
lpath = "lua/?.lua;lua/?/init.lua",
},
default = {
verbose = true
},
tests = {
verbose = true
},
}
2 changes: 2 additions & 0 deletions ci/schema/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Changelog

## 1.0.0

- Initial version.
7 changes: 5 additions & 2 deletions ci/schema/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.
# sample project

A sample command-line application with an entry point
in `bin/`, library code in `lib/`,
and example unit test in `test/`.
2 changes: 2 additions & 0 deletions ci/schema/output.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- markdownlint-disable -->

**Possible rust-analyzer settings (rust-analyzer 0.0.0 (634cfe3d7 2022-08-07))**
```lua
-- example opts
Expand Down
1 change: 1 addition & 0 deletions doc/ferris.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vim:tw=78:ts=8:noet:ft=help:norl:
27 changes: 27 additions & 0 deletions ferris.nvim-scm-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- NOTE: This rockspec is used for running busted tests only,
-- not for publishing to LuaRocks.org

local _MODREV, _SPECREV = 'scm', '-1'
rockspec_format = '3.0'
package = 'ferris.nvim'
version = _MODREV .. _SPECREV

dependencies = {
'lua >= 5.1',
}

test_dependencies = {
'lua >= 5.1',
}

source = {
url = 'git://github.com/mrcjkb/' .. package,
}

build = {
type = 'builtin',
copy_directories = {
'doc',
'ftplugin'
},
}
19 changes: 13 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
hooks = {
alejandra.enable = true;
stylua.enable = true;
# luacheck.enable = true;
luacheck.enable = true;
# lua-ls.enable = true;
# editorconfig-checker.enable = true;
# markdownlint.enable = true;
editorconfig-checker.enable = true;
markdownlint.enable = true;
};
settings = {
lua-ls = {
Expand Down Expand Up @@ -116,15 +116,22 @@
markdownlint-cli
];
};

docgen = pkgs.callPackage ./nix/docgen.nix {};
in {
devShells = {
default = devShell;
inherit devShell;
};

packages = rec {
default = nvim-plugin;
inherit (pkgs) nvim-plugin;
packages = let
ferris-nvim = pkgs.ferris-nvim;
in {
default = ferris-nvim;
inherit
ferris-nvim
docgen
;
};

checks = {
Expand Down
3 changes: 1 addition & 2 deletions nix/ci-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
self,
neodev-nvim,
plugin-name,
}: final: prev:
let
}: final: prev: let
nvim-nightly = final.neovim-nightly;

neodev-plugin = final.pkgs.vimUtils.buildVimPlugin {
Expand Down
11 changes: 11 additions & 0 deletions nix/docgen.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{pkgs, ...}:
pkgs.writeShellApplication {
name = "docgen";
runtimeInputs = with pkgs; [
lemmy-help
];
text = ''
mkdir -p doc
lemmy-help lua/ferris/config/init.lua > doc/ferris.txt
'';
}
2 changes: 1 addition & 1 deletion nix/plugin-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name,
self,
}: final: prev: {
nvim-plugin = final.pkgs.vimUtils.buildVimPlugin {
ferris-nvim = final.pkgs.vimUtils.buildVimPlugin {
inherit name;
src = self;
};
Expand Down
11 changes: 11 additions & 0 deletions spec/lsp_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe("LSP client API", function()
local FerrisConfig = require("ferris.config.internal")
local Types = require("ferris.types.internal")
local ra_bin = Types.evaluate(FerrisConfig.server.cmd)[1]
if vim.fn.executable(ra_bin) ~= 0 then
it("Can spin up rust-analyzer.", function()
--- TODO: Figure out how to add tests for this
print("TODO")
end)
end
end)

0 comments on commit 62360a2

Please sign in to comment.