Commits

Aleksey Khudyakov committed 801a774

Move build process to separate script

  • Participants
  • Parent commits c288be4

Comments (0)

Files changed (2)

 # command which exits with a non-zero exit code causes the build to fail.
 #
 script:
- # fixed-vector itself
- - cd histogram-fill
- - cabal-1.18 install   --enable-tests --only-dependencies
- - cabal-1.18 configure --enable-tests -v2  # -v2 provides useful information for debugging
- - cabal-1.18 build
- - cabal-1.18 test
- - cabal-1.18 sdist
- - export SRC_TGZ=$(cabal-1.18 info . | awk '{print $2 ".tar.gz";exit}') ;
-   cd dist/;
-   if [ -f "$SRC_TGZ" ]; then
-      cabal-1.18 install "$SRC_TGZ";
-   else
-      echo "expected '$SRC_TGZ' not found";
-      exit 1;
-   fi;
-   cd ..
- - cd ..
- # fixed-vector-cereal itself
- - cd histogram-fill-cereal
- - cabal-1.18 install   --enable-tests --only-dependencies
- - cabal-1.18 configure --enable-tests -v2  # -v2 provides useful information for debugging
- - cabal-1.18 build
- - cabal-1.18 test
- - cabal-1.18 sdist
- - export SRC_TGZ=$(cabal-1.18 info . | awk '{print $2 ".tar.gz";exit}') ;
-   cd dist/;
-   if [ -f "$SRC_TGZ" ]; then
-      cabal-1.18 install "$SRC_TGZ";
-   else
-      echo "expected '$SRC_TGZ' not found";
-      exit 1;
-   fi;
-   cd ..
- - cd ..
+ - sh test-package.sh histogram-fill
+ - sh test-package.sh histogram-fill-cereal

File test-package.sh

+#!/bin/sh
+set -e # Bail on first error
+set -v # Be verbose
+
+cd "$1"
+
+# Install dependencies, build and run test suite
+cabal-1.18 install   --enable-tests --only-dependencies
+cabal-1.18 configure --enable-tests -v2  # -v2 provides useful information for debugging
+cabal-1.18 build
+cabal-1.18 test
+
+# Check that tarball could be built and installed
+cabal-1.18 sdist
+SRC_TGZ=$(cabal-1.18 info . | awk '{print $2 ".tar.gz";exit}') ;
+cd dist/
+if [ -f "$SRC_TGZ" ]; then
+    cabal-1.18 install "$SRC_TGZ"
+else
+    echo "expected '$SRC_TGZ' not found"
+    exit 1
+fi