Skip to content

Commit

Permalink
[ADP-3368] Add nix flake to E2E tests (#4653)
Browse files Browse the repository at this point in the history
This pull request adds a `flake.nix` file to the E2E tests. This nix
flake only provisions the Ruby environment, but neither `cardano-wallet`
nor `cardano-node`, as these executables are the ones that are subject
to testing.

### Issue Number

ADP-3368
  • Loading branch information
paolino authored Jul 1, 2024
2 parents c49fea5 + 41801ee commit 8744cfe
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 16 deletions.
17 changes: 1 addition & 16 deletions nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,7 @@ CHaP: haskell-nix: nixpkgs-recent: nodePkgs: haskell-nix.cabalProject' [
filter = haskell-nix.haskellSourceFilter;
};

shell =
let
# To update gemset.nix, run:
# nix-shell --arg bins false --run bundix
gems = pkgs.bundlerEnv {
name = "gems-cardano-wallet-e2e";
gemdir = ../test/e2e;
ruby = pkgs.ruby_3_1;
};
in
{
shell = {
name = "cardano-wallet-shell${lib.optionalString config.profiling "-profiled"}";
packages = ps: builtins.attrValues (haskellLib.selectProjectPackages ps);
tools = {
Expand All @@ -140,11 +130,6 @@ CHaP: haskell-nix: nixpkgs-recent: nodePkgs: haskell-nix.cabalProject' [
nodePkgs.cardano-node
cardano-addresses-cli.components.exes.cardano-address
bech32.components.exes.bech32
# for e2e tests
gems
gems.wrappedRuby
pkgs.bundix
pkgs.screen
]) ++ (with pkgs.buildPackages.buildPackages; [
just
pkg-config
Expand Down
61 changes: 61 additions & 0 deletions test/e2e/flake.lock

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

52 changes: 52 additions & 0 deletions test/e2e/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
description = ''
Shell for the Ruby E2E tests.
This shell does *not* include `cardano-wallet` and `cardano-node`,
only the Ruby environment.
'';

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs";
};

outputs = inputs:
let
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
# The `blake2b` Ruby gem does not compile on aarch64-*
# "aarch64-linux"
# "aarch64-darwin"
]; in
inputs.flake-utils.lib.eachSystem supportedSystems (system:
let
# Imports
pkgs = inputs.nixpkgs.legacyPackages.${system};

# To update gemset.nix, run:
# nix develop -c bundix
gems = pkgs.bundlerEnv {
name = "gems-cardano-wallet-e2e";
gemdir = ./.;
ruby = pkgs.ruby_3_1;
};
in {
packages = { };

devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.curl
pkgs.jq
gems
gems.wrappedRuby
pkgs.bundix
pkgs.screen
];
shellHook = ''
# use this hook to set up additional environment variables
'';
};
}
);
}

0 comments on commit 8744cfe

Please sign in to comment.