From a4c4af83fdc9ba75c9b635ca770f0a261e7958f4 Mon Sep 17 00:00:00 2001 From: Will Coster Date: Sun, 26 Jul 2020 16:48:43 -0700 Subject: [PATCH 1/3] Update travis to use scalpel This should hopefully be more reliable than the previous cabalsandbox approach since package resolution is locked and do not change over time. --- .travis.yml | 82 ++++++++++++++++++--------------------- .travis/stack-lts-12.yaml | 10 +++++ .travis/stack-lts-16.yaml | 10 +++++ .travis/stack-lts-2.yaml | 10 +++++ .travis/stack-lts-3.yaml | 9 +++++ stack.yaml | 7 ++-- 6 files changed, 80 insertions(+), 48 deletions(-) create mode 100644 .travis/stack-lts-12.yaml create mode 100644 .travis/stack-lts-16.yaml create mode 100644 .travis/stack-lts-2.yaml create mode 100644 .travis/stack-lts-3.yaml 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..a979c14 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,7 +1,8 @@ flags: {} packages: -- prometheus-metrics-ghc/ -- wai-middleware-prometheus/ - example/ -- prometheus-client/ +- prometheus-client +- prometheus-metrics-ghc +- prometheus-proc +- wai-middleware-prometheus resolver: lts-11.2 From f60e3b5cd7c313d10b28254f437203975260d6cd Mon Sep 17 00:00:00 2001 From: Will Coster Date: Sun, 26 Jul 2020 17:24:32 -0700 Subject: [PATCH 2/3] Add unix-memory to default stack.yaml This is needed by prometheus-proc and is already listed in the ./travis/ stack yaml files. --- stack.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stack.yaml b/stack.yaml index a979c14..bf1585e 100644 --- a/stack.yaml +++ b/stack.yaml @@ -5,4 +5,6 @@ packages: - prometheus-metrics-ghc - prometheus-proc - wai-middleware-prometheus +extra-deps: +- unix-memory-0.1.2 resolver: lts-11.2 From 1e82e821bec1223576d2f6a002378e482fc97234 Mon Sep 17 00:00:00 2001 From: Will Coster Date: Sun, 26 Jul 2020 17:40:03 -0700 Subject: [PATCH 3/3] Bump default stack resolver to lts-12.14 promethus-proc relies on GHC 8.4. --- stack.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack.yaml b/stack.yaml index bf1585e..85060e5 100644 --- a/stack.yaml +++ b/stack.yaml @@ -7,4 +7,4 @@ packages: - wai-middleware-prometheus extra-deps: - unix-memory-0.1.2 -resolver: lts-11.2 +resolver: lts-12.14