Commit Graph

16 Commits

Author SHA1 Message Date
Erik Arvstedt
edbaeb9813
tests: define tests via flake
Advantages:
- Pure test evaluations
- The test framework can now be used by flakes that extend nix-bitcoin
- Most features of `run-tests.sh` are now accessible via `nix build`/`nix run`.
  We keep `run-tests.sh` for advanced features like `scenarioOverridesFile` and adhoc scenarios.

Other changes:
- `run-tests.sh` now builds aggregate VM tests like `basic` or
  `buildable` by creating all VMs in a single evaluation.
  This speeds up the tests and eases debugging by separating the eval and build steps.
- Use the new `nix` CLI which has improved build output logging
  by prefixing output lines with the origin drv name.
2022-11-03 23:08:06 +01:00
Erik Arvstedt
d3b7e8c432
revert "tests: disable nixosSearch" 2022-09-23 09:04:57 +02:00
Erik Arvstedt
c63da4734e
tests: disable nixosSearch 2022-09-05 21:11:15 +02:00
Erik Arvstedt
af115d746b
internal scripts: use pinned, cached pkgs
Instead of setting up the script PATH via nix-shell, use
`nix shell` with inputs from the nix-bitcoin flake.
Advantages:
- Uses the nixpkgs version from the nix-bitcoin flake instead of
  `<nixpkgs>` from the user env (NIX_PATH), so the script runtime
  env is reproducible.
- The pkg derivations for the runtime env are cached, which greatly
  increases script startup speed.

This commit was generated by running the following script inside the
repo root dir:

def transform(path, src)
  if src =~ /#! *nix-shell +-i +bash +-p +(.*)/
    pkgs = $1
    if src =~ /^.*?(set -e.*?pipefail)\n/
      set_statement = $1
      src.sub!($&, '')
    end
    src.sub!(/\A.*?#! *nix-shell.*?\n/m, '')

    parents = ([ '..' ] * (path.split('/').count - 1)).join('/')

    [
      '#!/usr/bin/env bash',
      *set_statement,
      %(. "${BASH_SOURCE[0]%/*}/#{parents}/helper/run-in-nix-env" "#{pkgs}" "$@"),
      nil,
      src
    ].join("\n")
  end
end

Dir['**/*.sh'].each do |f|
  src = File.read(f)
  if new_src = transform(f, src)
    puts "Changed file #{f}"
    File.write(f, new_src)
  end
end
2022-08-28 23:49:12 +02:00
Otto Sabart
9a92d29111
tests: add shellcheck 2022-08-28 18:25:37 +02:00
Erik Arvstedt
b625325487
ci/modules_test: use flake-enabled nix 2022-08-28 18:25:37 +02:00
Erik Arvstedt
a31d07d8bf
ci: update container image for modules tests
nixos/nix:latest has switched to Nix 2.5, but we should track
2.3.x, the default on NixOS stable.
2021-12-15 15:44:56 +01:00
Erik Arvstedt
1ef40ac230
ci: add flake test
- Check flake
- Check nixos-search doc generation
2021-12-12 16:21:12 +01:00
Erik Arvstedt
d3c8d7bd6f
.cirrus.yml: refactor
Required by the following commit.
2021-12-12 16:21:12 +01:00
Erik Arvstedt
26a53f0d59
ci: simplify test
Remove obsolete features that were required for pkgsUnstable.
2021-12-12 16:21:11 +01:00
Erik Arvstedt
0fd3be5343
move ci/ to test/ 2021-12-12 16:21:11 +01:00
Jonas Nick
daeea4012e
tests: remove pkgsUnstable
The latest nixpkgs-unstable update would require node-based packages to
distinguish between stable and unstable when building. Instead of dealing with
that complexity, we will only guarantee compatability of our packages with
stable.
2021-11-28 19:16:21 +00:00
nixbitcoin
41c4dd041e
test: add rtl & cl-rest 2021-11-09 14:13:49 +00:00
nixbitcoin
a10aa21c69
joinmarket: 0.9.2 -> 0.9.3 2021-10-27 16:02:59 +02:00
Erik Arvstedt
9a67a32779
fix build-to-cachix
- Don't fail on `kill $cachixPid` when cachix has already exited.
  This fixes some failing CI builds.

- Stop the cachix background worker before the final `cachix push`.
  This can avoid unneeded reuploads.
  Use the coreutils version of tail on cirrus which supports
  argument --pid.
2021-01-30 11:38:47 +01:00
Erik Arvstedt
1c0233c0a8
use Cirrus CI
- Make more economic use of the free CI resources by removing redundant build tasks:
  - Build unstable pkgs in a single separate task ("pkgs_unstable").
  - All stable pkgs are implicitly built by the modules tests.
- The build script (ci/build.sh) can now be executed locally for easier
  debugging.
- Use an explicit 'cachix push' command instead of helper/wait-for-network-idle.rb.
  This is simpler and more reliable.
2020-12-06 19:07:54 +01:00