Browse Source

Removes logs and sdist files after build to stop cache rebuilding

Abhinav Sarkar 3 years ago
parent
commit
a15b0b76ff
2 changed files with 17 additions and 9 deletions
  1. 11
    8
      .travis.yml
  2. 6
    1
      test_sdist

+ 11
- 8
.travis.yml View File

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

+ 6
- 1
test_sdist View File

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

Loading…
Cancel
Save