forked from srid/haskell-flake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntest.sh
executable file
·43 lines (37 loc) · 1.12 KB
/
runtest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
set -e
if [ "$(uname)" == "Darwin" ]; then
SYSTEM=aarch64-darwin
function logHeader {
echo "\n||| $@"
}
else
SYSTEM=x86_64-linux
function logHeader {
echo -e "\n||| $@"
}
fi
FLAKE=$(pwd)
# A Nix bug causes incorrect self when in a sub-flake.
# https://github.com/NixOS/nix/issues/7263
# Workaround: copy ./test somewhere outside of this Git repo.
TESTDIR=$(mktemp -d)
trap 'rm -fr "$TESTDIR"' EXIT
cp -r ./test/* "$TESTDIR"
cd "$TESTDIR"
pwd
# First, build the flake
logHeader "Testing nix build"
nix build --override-input haskell-flake path:${FLAKE}
# Run the devshell test script in a nix develop shell.
logHeader "Testing nix devshell"
nix develop --override-input haskell-flake path:${FLAKE} -c ./test.sh
# Test non-devshell features:
# Checks
logHeader "Testing nix flake checks"
nix --option sandbox false \
build --override-input haskell-flake path:${FLAKE} -L .#check
logHeader "Testing docs"
nix build --override-input haskell-flake path:${FLAKE} \
--option log-lines 1000 --show-trace \
github:hercules-ci/flake.parts-website#checks.${SYSTEM}.linkcheck
logHeader "All tests passed!"