2020-12-02 11:09:08 -08:00
|
|
|
task:
|
2021-12-10 05:07:57 -08:00
|
|
|
environment:
|
|
|
|
CACHIX_SIGNING_KEY: ENCRYPTED[!cec502ed813cbcd0237697d2031f750186ff20eed5815b1ad950ad2f2d701702ae6ba2f0cb4cb1985687a696c8ee492c!]
|
|
|
|
# Save some traffic by excluding the full git history
|
|
|
|
CIRRUS_CLONE_DEPTH: 1
|
|
|
|
|
2020-12-02 11:09:08 -08:00
|
|
|
# Use the maximum timeout. Needed when rebuilding packages on a channel update.
|
|
|
|
timeout_in: 120m
|
|
|
|
|
2022-08-27 04:34:39 -07:00
|
|
|
container:
|
|
|
|
# Defined in https://github.com/nix-community/docker-nixpkgs
|
2022-12-18 04:13:42 -08:00
|
|
|
image: nixpkgs/nix-flakes:nixos-22.11
|
2022-08-27 04:34:39 -07:00
|
|
|
|
2021-12-10 05:07:57 -08:00
|
|
|
matrix:
|
|
|
|
- name: modules_test
|
|
|
|
container:
|
|
|
|
# Besides virtualization, this also enables privileged containers which are required for
|
|
|
|
# sandboxed builds
|
|
|
|
kvm: true
|
|
|
|
# Needed for package builds
|
|
|
|
memory: 8G
|
|
|
|
# A maximum of 16 CPUs is shared among all concurrent tasks.
|
|
|
|
# https://cirrus-ci.org/faq/#are-there-any-limits
|
|
|
|
cpu: 4
|
|
|
|
environment:
|
|
|
|
matrix:
|
|
|
|
- scenario: default
|
|
|
|
- scenario: netns
|
|
|
|
- scenario: netnsRegtest
|
2023-03-03 12:00:00 -08:00
|
|
|
- scenario: trustedcoin
|
2021-12-10 05:07:57 -08:00
|
|
|
# This script is run as root
|
|
|
|
build_script:
|
|
|
|
- echo "sandbox = true" >> /etc/nix/nix.conf
|
2022-10-22 10:37:58 -07:00
|
|
|
- nix shell --inputs-from . nixpkgs#{bash,coreutils,cachix} -c ./test/ci/build.sh $scenario
|
2021-12-10 05:07:58 -08:00
|
|
|
|
|
|
|
- name: flake
|
|
|
|
build_script:
|
|
|
|
- nix flake check
|
2022-09-23 00:03:57 -07:00
|
|
|
- ./test/nixos-search/ci-test.sh
|
2022-08-16 12:00:00 -07:00
|
|
|
|
|
|
|
- name: shellcheck
|
|
|
|
build_script:
|
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-22 05:57:39 -07:00
|
|
|
- ./test/shellcheck.sh
|