Skip to content

Commit

Permalink
ci: replace linter action with nix and reorganise flake (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Mar 22, 2023
1 parent 95c6260 commit edaa93d
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 51 deletions.
6 changes: 1 addition & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
root = true

[*]
[*.*]
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

# Ignore
[LICENSE]
generated_code = true
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake -Lv
24 changes: 0 additions & 24 deletions .github/workflows/linter.yml

This file was deleted.

16 changes: 12 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
---
name: "Test Luarocks install"
name: "Tests and checks"
on: pull_request

jobs:
luarocks-release:
checks:
runs-on: ubuntu-latest
name: Test Luarocks install
name: Checks
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- name: Nix checks
run: nix flake check -L
tests:
runs-on: ubuntu-latest
name: Tests
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -15,7 +23,7 @@ jobs:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
with:
dependencies: |
plenary.nvim
dkjson
version: "0.0.0"
upload: false
copy_directories: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ jobs:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
with:
dependencies: |
plenary.nvim
telescope.nvim
dkjson
labels: |
neovim
summary: "Luarocks release workflow for GitHub"
Expand Down
3 changes: 0 additions & 3 deletions .hadolint.yaml

This file was deleted.

18 changes: 17 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 37 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,25 @@
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};

flake-utils.url = "github:numtide/flake-utils";
};

outputs = {
self,
nixpkgs,
flake-utils,
pre-commit-hooks,
...
}: let
supportedSystems = [
"x86_64-linux"
];
perSystem = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = system: import nixpkgs {inherit system;};
in
flake-utils.lib.eachSystem supportedSystems (system: let
pkgs = import nixpkgs {inherit system;};
inherit (pkgs) lib;

luarocks-tag-release-action-for = system: let
pkgs = pkgsFor system;
luarocks-tag-release-wrapped = pkgs.lua51Packages.buildLuaApplication {
pname = "luarocks-tag-release";
version = "scm-1";
Expand All @@ -35,8 +38,8 @@
luafilesystem
];
};
in
pkgs.writeShellApplication {

luarocks-tag-release-action = pkgs.writeShellApplication {
name = "luarocks-tag-release-action";
runtimeInputs = with pkgs; [
curl
Expand All @@ -54,12 +57,34 @@
# The default checkPhase depends on ShellCheck, which depends on GHC
checkPhase = "";
};
in {
packages = perSystem (system: let
luarocks-tag-release-action = luarocks-tag-release-action-for system;

formatting = pre-commit-hooks.lib.${system}.run {
src = self;
hooks = {
alejandra.enable = true;
stylua.enable = true;
luacheck.enable = true;
editorconfig-checker.enable = true;
markdownlint.enable = true;
};
settings = {
markdownlint.config = {
MD004 = false;
MD012 = false;
MD013 = false;
MD022 = false;
MD031 = false;
MD032 = false;
};
};
};
in {
default = luarocks-tag-release-action;
inherit luarocks-tag-release-action;
packages = {
default = luarocks-tag-release-action;
inherit luarocks-tag-release-action;
};
checks = {
inherit formatting;
};
});
};
}

0 comments on commit edaa93d

Please sign in to comment.