Removes logs and sdist files after build to stop cache rebuilding

master
Abhinav Sarkar 2017-11-17 11:01:44 +05:30
parent 789e5d9f38
commit a15b0b76ff
2 changed files with 17 additions and 9 deletions

View File

@ -4,12 +4,6 @@ sudo: false
# Choose a lightweight base image; we provide our own build tools.
language: c
# GHC depends on GMP. You can add other dependencies here as well.
addons:
apt:
packages:
- libgmp-dev
# The different configurations we want to test. You could also do things like
# change flags or use --stack-yaml to point to a different file.
env:
@ -36,12 +30,21 @@ before_install:
# executables, and test suites, and runs the test suites. --no-terminal works
# around some quirks in Travis's terminal implementation.
script:
- stack $ARGS --no-terminal install --test --fast
- export PATH=$(stack $ARGS path | grep compiler-bin | awk '{print $2}'):$PATH
- export DIST_DIR=$(stack $ARGS path | grep dist-dir | awk '{print $2}')
- export ARCH=$(echo $DIST_DIR | cut -d '/' -f 3)
- export GHC_VER=$(ghc --version | awk '{print $8}')
- stack $ARGS --no-terminal install --test --fast
- stack $ARGS sdist ringo-core && cd ringo-core && ../test_sdist
- cd $(stack $ARGS path | grep project-root | awk '{print $2}')
- cd $TRAVIS_BUILD_DIR
- stack $ARGS sdist ringo && cd ringo && ../test_sdist
before_cache:
- cd $TRAVIS_BUILD_DIR
- rm -rf .stack-work/logs;
- rm -rf $HOME/.cabal/logs;
- rm -rf $HOME/.cabal/lib/$ARCH-ghc-$GHC_VER/ringo*
# Caching so the next build will be fast too.
cache:
directories:

View File

@ -1,9 +1,14 @@
#!/bin/sh
set -e
SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}');
cd $(stack $ARGS path | grep dist-dir | awk '{print $2}');
cd $DIST_DIR;
if [ -f "$SRC_TGZ" ]; then
cabal install --only-dependencies "$SRC_TGZ";
cp $HOME/.ghc/$ARCH-$GHC_VER/package.conf.d/package.cache package.cache.bak
cabal install "$SRC_TGZ";
rm "$SRC_TGZ";
mv package.cache.bak $HOME/.ghc/$ARCH-$GHC_VER/package.conf.d/package.cache
else
echo "expected '$SRC_TGZ' not found";
exit 1;