|
1 | 1 | notifications:
|
2 | 2 | email: false
|
3 | 3 |
|
4 |
| -env: |
5 |
| - - CABALVER=1.18 GHCVER=7.8.4 |
6 |
| - - CABALVER=1.22 GHCVER=7.10.2 |
7 |
| - - CABALVER=2.2 GHCVER=8.4.2 |
8 |
| - |
9 |
| -before_install: |
10 |
| - - travis_retry sudo add-apt-repository -y ppa:hvr/ghc |
11 |
| - - travis_retry sudo apt-get update |
12 |
| - - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER # see note about happy/alex |
13 |
| - - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH |
14 |
| - |
15 |
| -install: |
16 |
| - - cabal --version |
17 |
| - - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" |
18 |
| - - travis_retry cabal update |
19 |
| - |
20 |
| -before_script: |
21 |
| - - wget https://www.stackage.org/lts/cabal.config |
22 |
| - - cabal sandbox init |
23 |
| - - cabal sandbox add-source prometheus-client |
24 |
| - - cabal sandbox add-source prometheus-metrics-ghc |
25 |
| - - cabal sandbox add-source wai-middleware-prometheus |
| 4 | +# Use new container infrastructure to enable caching |
| 5 | +sudo: false |
26 | 6 |
|
27 |
| - - cd prometheus-client |
28 |
| - - cabal sandbox init --sandbox ../.cabal-sandbox |
29 |
| - - cabal install --only-dependencies --enable-benchmarks --enable-tests |
30 |
| - - cabal configure --enable-tests |
| 7 | +# Choose a lightweight base image; we provide our own build tools. |
| 8 | +language: c |
31 | 9 |
|
32 |
| - - cd ../prometheus-metrics-ghc |
33 |
| - - cabal sandbox init --sandbox ../.cabal-sandbox |
34 |
| - - cabal install --only-dependencies --enable-benchmarks --enable-tests |
35 |
| - - cabal configure --enable-tests |
| 10 | +# GHC depends on GMP. You can add other dependencies here as well. |
| 11 | +addons: |
| 12 | + apt: |
| 13 | + packages: |
| 14 | + - libgmp-dev |
36 | 15 |
|
37 |
| - - cd ../wai-middleware-prometheus |
38 |
| - - cabal sandbox init --sandbox ../.cabal-sandbox |
39 |
| - - cabal install --only-dependencies --enable-benchmarks --enable-tests |
40 |
| - - cabal configure --enable-tests |
41 |
| - |
42 |
| - - cd ../example |
43 |
| - - cabal sandbox init --sandbox ../.cabal-sandbox |
44 |
| - - cabal install --only-dependencies --enable-benchmarks --enable-tests |
45 |
| - - cabal configure --enable-tests |
46 |
| - |
47 |
| - - cd .. |
| 16 | +# The different configurations we want to test. You could also do things like |
| 17 | +# change flags or use --stack-yaml to point to a different file. |
| 18 | +env: |
| 19 | + global: |
| 20 | + - ARGS="--no-terminal --install-ghc" |
| 21 | + - STACK_URL="https://www.stackage.org/stack/linux-x86_64" |
| 22 | + matrix: |
| 23 | + - YAML="./stack.yaml" CMD="bench prometheus-client" |
| 24 | + - YAML="./stack.yaml" CMD="test --haddock" |
| 25 | + - YAML="./.travis/stack-lts-2.yaml" CMD="test --haddock" STACK_URL="https://github.com/commercialhaskell/stack/releases/download/v1.5.1/stack-1.5.1-linux-x86_64-static.tar.gz" |
| 26 | + - YAML="./.travis/stack-lts-3.yaml" CMD="test --haddock" STACK_URL="https://github.com/commercialhaskell/stack/releases/download/v1.5.1/stack-1.5.1-linux-x86_64-static.tar.gz" |
| 27 | + - YAML="./.travis/stack-lts-12.yaml" CMD="test --haddock" |
| 28 | + - YAML="./.travis/stack-lts-16.yaml" CMD="test --haddock" |
48 | 29 |
|
| 30 | +before_install: |
| 31 | +# Download and unpack the stack executable |
| 32 | +- mkdir -p ~/.local/bin |
| 33 | +- export PATH=$HOME/.local/bin:$PATH |
| 34 | +- travis_retry curl -L $STACK_URL | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' |
| 35 | + |
| 36 | +# This line does all of the work: installs GHC if necessary, build the library, |
| 37 | +# executables, and test suites, and runs the test suites. --no-terminal works |
| 38 | +# around some quirks in Travis's terminal implementation. |
49 | 39 | script:
|
50 |
| - - cd prometheus-client && cabal build && cabal test |
51 |
| - - cd ../prometheus-metrics-ghc && cabal build && cabal test |
52 |
| - - cd ../wai-middleware-prometheus && cabal build && cabal test |
53 |
| - - cd ../example && cabal build |
| 40 | +- stack --stack-yaml $YAML $ARGS $CMD |
| 41 | + |
| 42 | +# Caching so the next build will be fast too. |
| 43 | +cache: |
| 44 | + directories: |
| 45 | + - $HOME/.stack |
0 commit comments