diff --git a/.travis.yml b/.travis.yml index 4734f7b..1a473d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,53 +1,45 @@ notifications: email: false -env: - - CABALVER=1.18 GHCVER=7.8.4 - - CABALVER=1.22 GHCVER=7.10.2 - - CABALVER=2.2 GHCVER=8.4.2 - -before_install: - - travis_retry sudo add-apt-repository -y ppa:hvr/ghc - - travis_retry sudo apt-get update - - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER # see note about happy/alex - - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH - -install: - - cabal --version - - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" - - travis_retry cabal update - -before_script: - - wget https://www.stackage.org/lts/cabal.config - - cabal sandbox init - - cabal sandbox add-source prometheus-client - - cabal sandbox add-source prometheus-metrics-ghc - - cabal sandbox add-source wai-middleware-prometheus +# Use new container infrastructure to enable caching +sudo: false - - cd prometheus-client - - cabal sandbox init --sandbox ../.cabal-sandbox - - cabal install --only-dependencies --enable-benchmarks --enable-tests - - cabal configure --enable-tests +# Choose a lightweight base image; we provide our own build tools. +language: c - - cd ../prometheus-metrics-ghc - - cabal sandbox init --sandbox ../.cabal-sandbox - - cabal install --only-dependencies --enable-benchmarks --enable-tests - - cabal configure --enable-tests +# GHC depends on GMP. You can add other dependencies here as well. +addons: + apt: + packages: + - libgmp-dev - - cd ../wai-middleware-prometheus - - cabal sandbox init --sandbox ../.cabal-sandbox - - cabal install --only-dependencies --enable-benchmarks --enable-tests - - cabal configure --enable-tests - - - cd ../example - - cabal sandbox init --sandbox ../.cabal-sandbox - - cabal install --only-dependencies --enable-benchmarks --enable-tests - - cabal configure --enable-tests - - - cd .. +# 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: + global: + - ARGS="--no-terminal --install-ghc" + - STACK_URL="https://www.stackage.org/stack/linux-x86_64" + matrix: + - YAML="./stack.yaml" CMD="bench prometheus-client" + - YAML="./stack.yaml" CMD="test --haddock" + - 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" + - 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" + - YAML="./.travis/stack-lts-12.yaml" CMD="test --haddock" + - YAML="./.travis/stack-lts-16.yaml" CMD="test --haddock" +before_install: +# Download and unpack the stack executable +- mkdir -p ~/.local/bin +- export PATH=$HOME/.local/bin:$PATH +- travis_retry curl -L $STACK_URL | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' + +# This line does all of the work: installs GHC if necessary, build the library, +# executables, and test suites, and runs the test suites. --no-terminal works +# around some quirks in Travis's terminal implementation. script: - - cd prometheus-client && cabal build && cabal test - - cd ../prometheus-metrics-ghc && cabal build && cabal test - - cd ../wai-middleware-prometheus && cabal build && cabal test - - cd ../example && cabal build +- stack --stack-yaml $YAML $ARGS $CMD + +# Caching so the next build will be fast too. +cache: + directories: + - $HOME/.stack diff --git a/.travis/stack-lts-12.yaml b/.travis/stack-lts-12.yaml new file mode 100644 index 0000000..c852469 --- /dev/null +++ b/.travis/stack-lts-12.yaml @@ -0,0 +1,10 @@ +flags: {} +packages: +- ../example/ +- ../prometheus-client +- ../prometheus-metrics-ghc +- ../prometheus-proc +- ../wai-middleware-prometheus +extra-deps: +- unix-memory-0.1.2 +resolver: lts-12.26 diff --git a/.travis/stack-lts-16.yaml b/.travis/stack-lts-16.yaml new file mode 100644 index 0000000..33ce712 --- /dev/null +++ b/.travis/stack-lts-16.yaml @@ -0,0 +1,10 @@ +flags: {} +packages: +- ../example/ +- ../prometheus-client +- ../prometheus-metrics-ghc +- ../prometheus-proc +- ../wai-middleware-prometheus +extra-deps: +- unix-memory-0.1.2 +resolver: lts-16.6 diff --git a/.travis/stack-lts-2.yaml b/.travis/stack-lts-2.yaml new file mode 100644 index 0000000..dc010b4 --- /dev/null +++ b/.travis/stack-lts-2.yaml @@ -0,0 +1,10 @@ +flags: {} +packages: +- ../example/ +- ../prometheus-client +- ../prometheus-metrics-ghc +- ../wai-middleware-prometheus +extra-deps: +- atomic-primops-0.8.2 +- clock-0.8 +resolver: lts-2.22 diff --git a/.travis/stack-lts-3.yaml b/.travis/stack-lts-3.yaml new file mode 100644 index 0000000..38a83fd --- /dev/null +++ b/.travis/stack-lts-3.yaml @@ -0,0 +1,9 @@ +flags: {} +packages: +- ../example/ +- ../prometheus-client +- ../prometheus-metrics-ghc +- ../wai-middleware-prometheus +extra-deps: +- clock-0.8 +resolver: lts-3.22 diff --git a/stack.yaml b/stack.yaml index da9c1b3..85060e5 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,7 +1,10 @@ flags: {} packages: -- prometheus-metrics-ghc/ -- wai-middleware-prometheus/ - example/ -- prometheus-client/ -resolver: lts-11.2 +- prometheus-client +- prometheus-metrics-ghc +- prometheus-proc +- wai-middleware-prometheus +extra-deps: +- unix-memory-0.1.2 +resolver: lts-12.14