Skip to content

Commit

Permalink
Experiment with Travis's build stages.
Browse files Browse the repository at this point in the history
  • Loading branch information
23Skidoo committed Jun 9, 2017
1 parent a1f9b33 commit b6df7d3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 16 deletions.
33 changes: 25 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# We specify language: c, so it doesn't default to e.g. ruby
language: c

dist: trusty
# dist: trusty

sudo: false

Expand Down Expand Up @@ -114,13 +114,30 @@ install:
# We intentionally do not install anything before trying to build Cabal because
# it should build with each supported GHC version out-of-the-box.

# Here starts the actual work to be performed for the package under test; any
# command which exits with a non-zero exit code causes the build to fail. Using
# ./dist/setup/setup here instead of cabal-install to avoid breakage when the
# build config format changed.
script:
- rm -rf dist-newstyle
- ./travis-${SCRIPT}.sh -j2
# All jobs except 'meta' have two stages; the first stage is used to
# warm up the cache. This is mostly useful when a new compiler gets
# added to the build matrix: work done installing dependencies is not
# wasted when we exceed the time limit for jobs.
jobs:
include:
- stage: prepare cache
env:
# All except 'meta' basically.
- SCRIPT=script
- SCRIPT=solver-debug-flags
- SCRIPT=bootstrap
- SCRIPT=stack
script: ./travis-precache.sh
after_success: skip
- stage: test
# Here starts the actual work to be performed for the package
# under test; any command which exits with a non-zero exit code
# causes the build to fail. Using ./dist/setup/setup here
# instead of cabal-install to avoid breakage when the build
# config format changed.
script:
- rm -rf dist-newstyle
- ./travis-${SCRIPT}.sh -j2

cache:
directories:
Expand Down
23 changes: 23 additions & 0 deletions travis-precache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

. ./travis-common.sh

# ---------------------------------------------------------------------
# Update the Cabal index
# ---------------------------------------------------------------------

timed cabal update

# ---------------------------------------------------------------------
# Setup our local project
# ---------------------------------------------------------------------

cp cabal.project.travis cabal.project.local

# ---------------------------------------------------------------------
# Warm up the cache
# ---------------------------------------------------------------------

# TODO: Don't build Cabal and hackage-security here, they'll be
# rebuilt anyway.
timed cabal new-build --only-dependencies cabal-install cabal-tests
8 changes: 0 additions & 8 deletions travis-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ esac

timed cabal update

# ---------------------------------------------------------------------
# Install executables if necessary
# ---------------------------------------------------------------------

if ! command -v happy; then
timed cabal install $jobs happy
fi

# ---------------------------------------------------------------------
# Setup our local project
# ---------------------------------------------------------------------
Expand Down

0 comments on commit b6df7d3

Please sign in to comment.