Skip to content

Commit

Permalink
nix: Include tests and updated .BAT files in the Windows bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Oct 25, 2019
1 parent efadbc9 commit 7ccc983
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 21 additions & 3 deletions nix/windows-release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
############################################################################

{ pkgs
, cardano-wallet-jormungandr
, project
, cardano-wallet-jormungandr
, tests ? []
, benchmarks ? []
}:

let
Expand All @@ -19,10 +21,15 @@ let
jormungandr.exe --config config.yaml --genesis-block block0.bin --secret secret.yaml
'';
cw-bat = pkgs.writeText "cw.bat" ''
cardano-wallet-jormungandr.exe serve --node-port 8081 --genesis-hash HASH --database c:\\cardano-wallet-jormungandr\\wallet.db
cardano-wallet-jormungandr.exe serve --node-port 8080 --genesis-block-hash HASH --database c:\\cardano-wallet-jormungandr\\wallets
'';
launch-bat = pkgs.writeText "launch.bat" ''
cardano-wallet-jormungandr.exe launch --genesis-block-hash HASH --state-dir c:\\cardano-wallet-jormungandr %*
'';

in pkgs.runCommand name {
nativeBuildInputs = [ pkgs.zip pkgs.jq pkgs.gnused project.jormungandr-cli ];
passthru = { inherit tests benchmarks; };
} ''
mkdir -pv jm $out/nix-support
cd jm
Expand All @@ -32,8 +39,19 @@ in pkgs.runCommand name {
cp -v ${jm-bat} jm.bat
hash="$(jcli genesis hash --input block0.bin)"
sed -e "s/HASH/$hash/" ${cw-bat} > cw.bat
sed -e 's/storage:.*/storage: "c:\\\\cardano-wallet-jormungandr\\\\storage"/' \
sed -e "s/HASH/$hash/" ${launch-bat} > launch.bat
sed -e 's/storage:.*/storage: "c:\\\\cardano-wallet-jormungandr\\\\chain"/' \
${testData}/config.yaml > config.yaml
${pkgs.lib.concatMapStringsSep "\n" (test: ''
pkg=`ls -1 ${test}`
exe=`cd ${test}; ls -1 $pkg`
name=$pkg-test-$exe
cp ${test}/$pkg/$exe $name
echo $name >> tests.bat
echo "if %errorlevel% neq 0 exit /b %errorlevel%" >> tests.bat
'') tests}
chmod -R +w .
zip -r $out/${name}.zip .
Expand Down
2 changes: 2 additions & 0 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ let
cardano-wallet-jormungandr-win64 = import ./nix/windows-release.nix {
inherit pkgs project;
cardano-wallet-jormungandr = jobs.x86_64-pc-mingw32.cardano-wallet-jormungandr.x86_64-linux;
tests = collectTests jobs.x86_64-pc-mingw32.tests;
benchmarks = collectTests jobs.x86_64-pc-mingw32.benchmarks;
};

# These derivations are used for the Daedalus installer.
Expand Down

0 comments on commit 7ccc983

Please sign in to comment.