Skip to content

Commit

Permalink
Merge pull request #47 from ptitfred/drop-github-actions
Browse files Browse the repository at this point in the history
Actually launch tests from Garnix
  • Loading branch information
ptitfred authored Oct 16, 2024
2 parents b15a2d8 + fadbf69 commit 56c5d31
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
8 changes: 8 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@
overlay = _: _: { inherit posix-toolbox; };

homeManagerModule = import ./home-manager-module.nix posix-toolbox;

helpers = pkgs.callPackages ./helpers.nix {};

in {
inherit overlay;
overlays.default = overlay;

packages.${system} = tests // { inherit default; };

checks.${system} = helpers.mkChecks {
lint = "${tests.lint}/bin/posix-toolbox-lint-nix ${./.}";
spell = "${tests.spell}/bin/posix-toolbox-spell ${./.}";
};

homeManagerModules.default = homeManagerModule;

homeConfigurations = {
Expand Down
9 changes: 9 additions & 0 deletions helpers.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ runCommand, lib }:

let mkCheck = name: script:
runCommand name {} ''
mkdir -p $out
${script}
'';

in { mkChecks = lib.attrsets.mapAttrs mkCheck; }
2 changes: 1 addition & 1 deletion tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ in
lint = writeShellApplication {
name = "posix-toolbox-lint-nix";
runtimeInputs = [ nix-linter ];
text = "find . -name '*.nix' -exec nix-linter {} +";
text = builtins.readFile ./lint.sh;
};
spell = writeShellApplication {
name = "posix-toolbox-spell";
Expand Down
14 changes: 14 additions & 0 deletions tests/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set -e

src="."
if [ $# -ge 1 ]
then
src="$1"
fi

if [ -z "$src" ]
then
src="."
fi

find "$src" -type f -name "*.nix" -exec nix-linter {} + && echo "Everything is fine!"
15 changes: 14 additions & 1 deletion tests/spell.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
set -e

src="."
if [ $# -ge 1 ]
then
src="$1"
fi

if [ -z "$src" ]
then
src="."
fi

function check {
local filename="$1"
echo "$filename"
aspell list < "$filename"
}

check README.md
check "$src"/README.md

0 comments on commit 56c5d31

Please sign in to comment.