urbit/sh/cachix
~siprel 382ace5f23 travis: Various fixes and improvements.
1. Fix bug in test builds that was causing failures for some reason I
   still don't understand.

  `tee` output to stderr was failing with "resource temporarily
  unavailable". The hack that fixed it was to simply write the herb
  output to a file and dump it to stdout after it fully completes.

2. sh/cachix works without CACHIX keys. Simply doesn't upload in that case.

3. Write code to cache testbus builds (disabled for now)

4. fakeship builds get further in bootstrap sequence before committing.

  This fixes problems with PRs from forked repos and enables the scripts
  to be run locally.
2020-06-11 20:34:50 +00:00

52 lines
893 B
Bash
Executable File

#!/usr/bin/env bash
fail () {
echo "$@"
if [ "$TRAVIS_PULL_REQUEST" = false ]
then exit 1
else exit 0
fi
}
cache=1
if [ -z "$CACHIX_SIGNING_KEY" ]
then
echo "The CACHIX_SIGNING_KEY environment variable needs to be set."
echo "Disabling cachix uploads"
cache=0
fi
if [ -z "$CACHIX_AUTH_TOKEN" ]
then
echo "The CACHIX_AUTH_TOKEN environment variable needs to be set."
echo "Disabling cachix uploads"
cache=0
fi
cleanup () {
rm -f .cache.list
}
trap cleanup EXIT
set -ex
if [ $cache = 1 ]
then cachix authtoken "$CACHIX_AUTH_TOKEN" >/dev/null
fi
cachix use urbit2 || true
build () {
nix-build --no-out-link --max-jobs 3 "$@" > .cache.list
if [ $cache = 1 ]
then cachix push urbit2 < .cache.list
fi
}
time build nix/cachix/local.nix
#time build nix/cachix/tests.nix -A fakebus
time build nix/cachix/tests.nix -A results
time build nix/cachix/release.nix