1
1
mirror of https://github.com/nmattia/niv.git synced 2024-12-01 15:56:03 +03:00
niv/script/test

52 lines
876 B
Plaintext
Raw Normal View History

2019-02-01 17:51:40 +03:00
#!/usr/bin/env nix-shell
#!nix-shell -i bash
#!nix-shell -I nixpkgs=./nix
#!nix-shell -p nix
2019-12-31 14:27:51 +03:00
#!nix-shell -p nixpkgs-fmt
2019-02-01 17:51:40 +03:00
2019-02-03 16:07:42 +03:00
set -euo pipefail
export NIX_PATH="nixpkgs=./nix"
2019-02-01 17:51:40 +03:00
echo "Building"
2019-12-08 17:13:53 +03:00
nixargs=(
"--no-link"
"--max-jobs" "10"
)
targets=(
)
2019-12-08 17:13:53 +03:00
if [[ ! $OSTYPE =~ darwin ]]; then
echo "Not testing on darwin"
echo "Enabling sandbox, running all tests"
nixargs+=("--sandbox")
else
echo "Testing on darwin"
echo "Not enabling sandbox, not running integration"
targets+=("-A" "niv-test")
2019-12-08 17:13:53 +03:00
fi
2019-02-05 16:19:17 +03:00
# Build and create a root
nix-build ${nixargs[@]} ${targets[@]}
2019-02-03 16:07:42 +03:00
2019-12-31 14:27:51 +03:00
echo "Formatting"
if ! nixpkgs-fmt --check . ; then
echo
echo 'run `nixpkgs-fmt .` to fix this issue'
exit 1
fi
echo "Building examples"
for example in examples/*; do
echo " - $(basename $example)"
pushd $example
nix-build ${nixargs[@]}
popd
done
2019-02-01 17:51:40 +03:00
echo "all good"