mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-27 16:33:05 +03:00
add test for aggregated fetching: github source
This commit is contained in:
parent
e99487cee9
commit
4cf80a1460
@ -61,6 +61,8 @@ rec {
|
||||
|
||||
listDirs = path: lib.attrNames (lib.filterAttrs (n: v: v == "directory") (builtins.readDir path));
|
||||
|
||||
toDrv = path: runCommand "some-drv" {} "cp -r ${path} $out";
|
||||
|
||||
# directory names of a given directory
|
||||
dirNames = dir: lib.attrNames (lib.filterAttrs (name: type: type == "directory") (builtins.readDir dir));
|
||||
|
||||
|
@ -5,45 +5,17 @@
|
||||
}:
|
||||
|
||||
let
|
||||
lib = pkgs.lib // builtins;
|
||||
l = pkgs.lib // builtins;
|
||||
|
||||
makeTest =
|
||||
{
|
||||
name,
|
||||
source,
|
||||
cmds,
|
||||
}:
|
||||
let
|
||||
outputs = dream2nix.riseAndShine {
|
||||
inherit source;
|
||||
};
|
||||
commandsToRun = cmds outputs;
|
||||
in
|
||||
pkgs.runCommand "test-${name}" {}
|
||||
(lib.concatStringsSep "\n" commandsToRun);
|
||||
|
||||
projects = {
|
||||
prettier = {
|
||||
source = lib.fetchTarball {
|
||||
url = "https://github.com/prettier/prettier/tarball/2.4.1";
|
||||
sha256 = "19b37qakhlsnr2n5bgv83aih5npgzbad1d2p2rs3zbq5syqbxdyi";
|
||||
};
|
||||
cmds = outputs:
|
||||
let
|
||||
prettier = outputs.defaultPackage.overrideAttrs (old: {
|
||||
dontBuild = true;
|
||||
});
|
||||
in
|
||||
[
|
||||
"${prettier}/bin/prettier --version | grep -q 2.4.1 && mkdir $out"
|
||||
];
|
||||
};
|
||||
buildProjectsTests = import ./projects.nix {
|
||||
inherit lib pkgs dream2nix;
|
||||
};
|
||||
|
||||
allTests =
|
||||
lib.mapAttrs
|
||||
(name: args: makeTest (args // { inherit name; }))
|
||||
projects;
|
||||
otherTests = import ./other {
|
||||
inherit lib pkgs dream2nix;
|
||||
};
|
||||
|
||||
in
|
||||
allTests
|
||||
buildProjectsTests
|
||||
//
|
||||
otherTests
|
||||
|
21
tests/pure/other/default.nix
Normal file
21
tests/pure/other/default.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
lib ? pkgs.lib,
|
||||
pkgs ? import <nixpkgs> {},
|
||||
dream2nix ? import ./src { inherit pkgs; },
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
l = pkgs.lib // builtins;
|
||||
|
||||
fetchAggrgatedGithub =
|
||||
dream2nix.utils.toDrv
|
||||
(dream2nix.fetchSources {
|
||||
dreamLock = ./prettier.json;
|
||||
}).fetchedSources.prettier."2.4.1";
|
||||
|
||||
in
|
||||
{
|
||||
inherit fetchAggrgatedGithub;
|
||||
}
|
||||
|
30
tests/pure/other/prettier.json
Normal file
30
tests/pure/other/prettier.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"_generic": {
|
||||
"mainPackageName": "prettier",
|
||||
"mainPackageVersion": "2.4.1",
|
||||
"sourcesAggregatedHash": "sha256-AR5QtVJE15NCLJpjWdg6UxhIEwFGsCAne5TI3DcOMeI=",
|
||||
"subsystem": "nodejs",
|
||||
"translatedBy": "nodejs.pure.yarn-lock",
|
||||
"translator": "yarn-lock",
|
||||
"translatorParams": ""
|
||||
},
|
||||
"_subsystem": {
|
||||
"nodejsVersion": "14"
|
||||
},
|
||||
"cyclicDependencies": {},
|
||||
"dependencies": {
|
||||
"prettier": {
|
||||
"2.4.1": []
|
||||
}
|
||||
},
|
||||
"sources": {
|
||||
"prettier": {
|
||||
"2.4.1": {
|
||||
"owner": "prettier",
|
||||
"repo": "prettier",
|
||||
"rev": "2.4.1",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
49
tests/pure/projects.nix
Normal file
49
tests/pure/projects.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
lib ? pkgs.lib,
|
||||
pkgs ? import <nixpkgs> {},
|
||||
dream2nix ? import ./src { inherit pkgs; },
|
||||
}:
|
||||
|
||||
let
|
||||
lib = pkgs.lib // builtins;
|
||||
|
||||
makeTest =
|
||||
{
|
||||
name,
|
||||
source,
|
||||
cmds,
|
||||
}:
|
||||
let
|
||||
outputs = dream2nix.riseAndShine {
|
||||
inherit source;
|
||||
};
|
||||
commandsToRun = cmds outputs;
|
||||
in
|
||||
pkgs.runCommand "test-${name}" {}
|
||||
(lib.concatStringsSep "\n" commandsToRun);
|
||||
|
||||
projects = {
|
||||
prettier = {
|
||||
source = lib.fetchTarball {
|
||||
url = "https://github.com/prettier/prettier/tarball/2.4.1";
|
||||
sha256 = "19b37qakhlsnr2n5bgv83aih5npgzbad1d2p2rs3zbq5syqbxdyi";
|
||||
};
|
||||
cmds = outputs:
|
||||
let
|
||||
prettier = outputs.defaultPackage.overrideAttrs (old: {
|
||||
dontBuild = true;
|
||||
});
|
||||
in
|
||||
[
|
||||
"${prettier}/bin/prettier --version | grep -q 2.4.1 && mkdir $out"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
allTests =
|
||||
lib.mapAttrs
|
||||
(name: args: makeTest (args // { inherit name; }))
|
||||
projects;
|
||||
|
||||
in
|
||||
allTests
|
Loading…
Reference in New Issue
Block a user