1
1
mirror of https://github.com/nmattia/niv.git synced 2024-11-07 22:36:53 +03:00
niv/script/test
Nicolas Mattia 0b2d1dc06e Remove the niv-test executable
This moves the tests into a `tests` section of the `package.yaml`. Otherwise, the `niv-test` is shipped with the actual executable.
2020-01-20 18:12:13 +01:00

52 lines
871 B
Plaintext
Executable File

#!/usr/bin/env nix-shell
#!nix-shell -i bash
#!nix-shell -I nixpkgs=./nix
#!nix-shell -p nix
#!nix-shell -p nixpkgs-fmt
set -euo pipefail
export NIX_PATH="nixpkgs=./nix"
echo "Building"
nixargs=(
"--no-link"
"--max-jobs" "10"
)
targets=(
)
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")
fi
# Build and create a root
nix-build ${nixargs[@]} ${targets[@]}
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
echo "all good"