diff --git a/.travis.yml b/.travis.yml index 5d7efd0a0a..0b29f745de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,31 @@ -language: nix -nix: 2.1.3 +# TODO Only do release builds on the `pull` branch? -os: - - linux - - osx +jobs: + include: +# - os: linux +# language: nix +# nix: 2.1.3 +# install: +# - nix-env -iA cachix -f https://cachix.org/api/v1/install + +# script: +# - cachix use urbit2 +# - ./sh/cachix +# - make build-fast +# - make release +# - sh/ci-tests + + - os: osx + language: generic + sudo: required + script: + - ver="$(git rev-parse HEAD)" + - if [ -n "${TRAVIS_COMMIT-}" ]; then ver="$TRAVIS_COMMIT"; fi + - if [ -n "${TRAVIS_TAG-}" ]; then ver="$TRAVIS_TAG"; fi + - stack clean + - stack install king --local-bin-path ./release + - mv release/king release/king-darwin-$ver + - otool -L release/king-darwin-$ver cache: directories: @@ -17,17 +39,8 @@ before_install: - sh/travis-install-stack install: - - nix-env -iA cachix -f https://cachix.org/api/v1/install - stack --no-terminal --install-ghc build king --only-dependencies -# TODO Only do release builds on the `pull` branch? -script: - - cachix use urbit2 - - ./sh/cachix || true - - make build-fast - - make release - - sh/ci-tests - deploy: - skip_cleanup: true provider: gcs diff --git a/sh/travis-install-stack b/sh/travis-install-stack index 319379e69a..183c6a31a0 100755 --- a/sh/travis-install-stack +++ b/sh/travis-install-stack @@ -2,20 +2,39 @@ set -ex + +## +## Make sure this is running OSX/Linux in Travis +## + +os="$TRAVIS_OS_NAME" + +[ "$os" = osx ] || [ "$os" = linux ] + + +## +## Download the stack executable. +## + mkdir -p ~/.local/bin -# OSX -# curl -L https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin +stackurl="https://get.haskellstack.org/stable/$os-x86_64.tar.gz" -mkdir -p tmp +case $os in + osx) + curl -L "$stackurl" | + tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin + linux) + mkdir -p tmp + curl -L "$stackurl" | tar xz -C tmp + mv tmp/stack-*/stack ~/.local/bin +esac -pax="https://get.haskellstack.org/stable/linux-x86_64.tar.gz" -curl -L $pax | tar xz -C tmp +## +## Use the more reliable S3 mirror of Hackage. +## -mv tmp/stack-*/stack ~/.local/bin - -# Use the more reliable S3 mirror of Hackage mkdir -p ~/.cabal cat > ~/.cabal/config <