Skip to content

Commit

Permalink
chore: add some tests
Browse files Browse the repository at this point in the history
Signed-off-by: Drew Hess <[email protected]>
  • Loading branch information
dhess committed Oct 11, 2023
1 parent 95df048 commit 79db081
Show file tree
Hide file tree
Showing 15 changed files with 545 additions and 2 deletions.
13 changes: 11 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@
})
// haskellNixFlake.packages;

checks = haskellNixFlake.checks;
checks = {
inherit (pkgs) nix-buildkite-tests;
} // haskellNixFlake.checks;

apps =
let
Expand Down Expand Up @@ -246,6 +248,7 @@
nodejs-18_x

nixpkgs-fmt
goldplate
]);

shellHook = ''
Expand Down Expand Up @@ -297,12 +300,18 @@
};
};

nix-buildkite-tests = final.callPackage ./nix/pkgs/nix-buildkite-tests {
src = ./tests;
};
in
{
inherit nix-buildkite-plugin;
inherit (final.haskellPackages) goldplate;

inherit nix-buildkite-plugin;
nix-buildkite = nixBuildkiteFlake.packages."nix-buildkite-plugin:exe:nix-buildkite";
inherit nix-buildkite-docker-image;

inherit nix-buildkite-tests;
}
);

Expand Down
20 changes: 20 additions & 0 deletions nix/pkgs/nix-buildkite-tests/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ goldplate
, nix
, nix-buildkite
, runCommand
, src
}:
runCommand "nix-buildkite-tests"
{
inherit src;
nativeBuildInputs = [
goldplate
nix
nix-buildkite
];
} ''
set -e
cd $src
goldplate -j2 --pretty-diff .
touch $out
''
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(import ./flake-compat.nix).defaultNix
9 changes: 9 additions & 0 deletions tests/flake-compat.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
inherit (lock.nodes.flake-compat.locked) owner repo rev narHash;
flake-compat = builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
sha256 = narHash;
};
in
import flake-compat { src = ./.; }
Loading

0 comments on commit 79db081

Please sign in to comment.