-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update flake and integration testing (#110)
- Loading branch information
1 parent
1b2ca8d
commit a162fda
Showing
12 changed files
with
398 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
CACHIX_BINARY_CACHE: altf4llc-os | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- uses: cachix/cachix-action@v14 | ||
with: | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
name: ${{ env.CACHIX_BINARY_CACHE }} | ||
- uses: actions/checkout@v4 | ||
- run: nix develop -c just check | ||
|
||
build: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
profile: | ||
- default | ||
- neovim | ||
steps: | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- uses: cachix/cachix-action@v14 | ||
with: | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
name: ${{ env.CACHIX_BINARY_CACHE }} | ||
- uses: actions/checkout@v4 | ||
- run: nix develop -c just build "${{ matrix.profile }}" | ||
|
||
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
suite: | ||
- lint | ||
- unit | ||
steps: | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- uses: cachix/cachix-action@v14 | ||
with: | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
name: ${{ env.CACHIX_BINARY_CACHE }} | ||
- uses: actions/checkout@v4 | ||
- run: nix develop -c just test-${{ matrix.suite }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.direnv | ||
|
||
# Compiled Lua sources | ||
luac.out | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- vim: ft=lua tw=80 | ||
|
||
-- Rerun tests only if their modification time changed. | ||
cache = true | ||
|
||
ignore = { | ||
"122", -- Setting a read-only field of a global variable. | ||
"212", -- Unused argument, In the case of callback function, _arg_name is easier to understand than _, so this option is set to off. | ||
"631", -- max_line_length, vscode pkg URL is too long | ||
} | ||
|
||
-- Global objects defined in the plugin | ||
globals = { | ||
"Config" | ||
} | ||
|
||
-- Global objects defined by the C code | ||
read_globals = { | ||
"vim", | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,64 @@ | ||
{ | ||
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; | ||
description = "lspcontainers.nvim"; | ||
|
||
outputs = { self, nixpkgs }: | ||
let | ||
supportedSystems = | ||
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; | ||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems; | ||
pkgs = forAllSystems (system: | ||
import nixpkgs { | ||
overlays = [ ]; | ||
inherit system; | ||
}); | ||
in { | ||
packages = forAllSystems (system: { | ||
default = pkgs.${system}.vimUtils.buildVimPluginFrom2Nix { | ||
name = "lspcontainers.nvim"; | ||
src = ./.; | ||
}; | ||
neovim = pkgs.${system}.neovim.override { | ||
configure = { | ||
customRC = '' | ||
lua << EOF | ||
${(builtins.readFile ./init.lua)}; | ||
EOF | ||
''; | ||
packages.main = with pkgs.${system}.vimPlugins; { | ||
start = [ | ||
nvim-lspconfig | ||
self.packages.${system}.default | ||
]; | ||
inputs = { | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
}; | ||
|
||
outputs = inputs @ {flake-parts, ...}: | ||
flake-parts.lib.mkFlake {inherit inputs;} { | ||
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"]; | ||
|
||
perSystem = { | ||
config, | ||
pkgs, | ||
system, | ||
... | ||
}: let | ||
inherit (pkgs) just luajitPackages mkShell neovim vimPlugins vimUtils writeShellApplication; | ||
inherit (luajitPackages) luacheck vusted; | ||
in { | ||
packages = { | ||
default = vimUtils.buildVimPlugin { | ||
name = "lspcontainers.nvim"; | ||
src = ./.; | ||
}; | ||
|
||
neovim = neovim.override { | ||
configure = { | ||
customRC = '' | ||
lua << EOF | ||
${(builtins.readFile ./init.lua)}; | ||
EOF | ||
''; | ||
packages.main = with vimPlugins; { | ||
start = [ | ||
nvim-lspconfig | ||
config.packages.default | ||
]; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}); | ||
|
||
devShells = forAllSystems (system: { | ||
default = pkgs.${system}.mkShellNoCC { | ||
buildInputs = [ self.packages.${system}.neovim ]; | ||
devShells = { | ||
default = mkShell { | ||
nativeBuildInputs = [just luacheck vusted]; | ||
}; | ||
}; | ||
}); | ||
|
||
apps = forAllSystems (system: { | ||
neovim = { | ||
program = "${self.packages.${system}.neovim}/bin/nvim"; | ||
type = "app"; | ||
apps = { | ||
neovim = { | ||
program = "${config.packages.neovim}/bin/nvim"; | ||
type = "app"; | ||
}; | ||
|
||
test = { | ||
program = "${config.packages.test}/bin/test"; | ||
type = "app"; | ||
}; | ||
}; | ||
}); | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
_default: | ||
just --list | ||
|
||
build profile="default": | ||
nix build --json --no-link --print-build-logs ".#{{ profile }}" | ||
|
||
check: | ||
nix flake check | ||
|
||
test: test-lint test-unit | ||
|
||
test-lint: | ||
luacheck ./lua ./test | ||
|
||
test-unit: | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
export VUSTED_NVIM=$(just build 'neovim' | jq -r '.[].outputs.out')/bin/nvim | ||
vusted ./test |
Oops, something went wrong.