Skip to content

Commit

Permalink
Merge branch 'travis-cabal-new'
Browse files Browse the repository at this point in the history
  • Loading branch information
himura committed Jun 1, 2019
2 parents 34a96f3 + 1a45957 commit af76b21
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 99 deletions.
175 changes: 140 additions & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,150 @@
sudo: false
# This Travis job script has been generated by a script via
#
# haskell-ci 'cabal.project'
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.3.20190521
#
language: c

dist: xenial
git:
# whether to recursively clone submodules
submodules: false
cache:
directories:
- $HOME/.cabal/packages
- $HOME/.cabal/store
before_cache:
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
# remove files that are regenerated by 'cabal update'
- rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
- rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
- rm -rfv $CABALHOME/packages/head.hackage
matrix:
include:
- env: GHCVER=7.8.4 STACK_LTS=lts-2 STACK_TEMPLATE=stack-lts-2.yaml
addons:
apt:
sources: [ hvr-ghc ]
packages: [ ghc-7.8.4 ]
- env: GHCVER=7.10.3 STACK_LTS=lts-6 STACK_TEMPLATE=stack-lts-6.yaml
addons:
apt:
sources: [ hvr-ghc ]
packages: [ ghc-7.10.3 ]
- env: GHCVER=8.0.1 STACK_LTS=lts-7 STACK_TEMPLATE=stack-lts-7.yaml
addons:
apt:
sources: [ hvr-ghc ]
packages: [ ghc-8.0.1 ]

- compiler: ghc-8.6.5
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}}
- compiler: ghc-8.4.4
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}
- compiler: ghc-8.2.2
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}
- compiler: ghc-8.0.2
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-2.4"]}}
before_install:
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
- export PATH=/opt/ghc/$GHCVER/bin:$PATH
- m4 -D__RESOLVER__=$(curl -sL https://www.stackage.org/download/snapshots.json | jq '."'$STACK_LTS'"' -r) .travis/$STACK_TEMPLATE > stack.yaml

- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
- HCPKG="$HC-pkg"
- unset CC
- CABAL=/opt/ghc/bin/cabal
- CABALHOME=$HOME/.cabal
- export PATH="$CABALHOME/bin:$PATH"
- TOP=$(pwd)
- HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
- echo $HCNUMVER
- CABAL="$CABAL -vnormal+nowrap+markoutput"
- set -o pipefail
- |
echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
echo 'BEGIN { state = "output"; }' >> .colorful.awk
echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
echo ' if (state == "cabal") {' >> .colorful.awk
echo ' print blue($0)' >> .colorful.awk
echo ' } else {' >> .colorful.awk
echo ' print $0' >> .colorful.awk
echo ' }' >> .colorful.awk
echo '}' >> .colorful.awk
- cat .colorful.awk
- |
color_cabal_output () {
awk -f $TOP/.colorful.awk
}
- echo text | color_cabal_output
install:
- travis_wait stack --no-terminal --skip-ghc-check setup
- travis_wait stack --no-terminal --skip-ghc-check test --only-snapshot

- ${CABAL} --version
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
- TEST=--enable-tests
- BENCH=--enable-benchmarks
- GHCHEAD=${GHCHEAD-false}
- rm -f $CABALHOME/config
- |
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
echo "world-file: $CABALHOME/world" >> $CABALHOME/config
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
echo "install-dirs user" >> $CABALHOME/config
echo " prefix: $CABALHOME" >> $CABALHOME/config
echo "repository hackage.haskell.org" >> $CABALHOME/config
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
- cat $CABALHOME/config
- rm -fv cabal.project cabal.project.local cabal.project.freeze
- travis_retry ${CABAL} v2-update -v
# Generate cabal.project
- rm -rf cabal.project cabal.project.local cabal.project.freeze
- touch cabal.project
- |
echo 'packages: "twitter-types"' >> cabal.project
echo 'packages: "twitter-types-lens"' >> cabal.project
- |
echo "write-ghc-environment-files: always" >> cabal.project
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(twitter-types|twitter-types-lens)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true
- cat cabal.project.local || true
- if [ -f "twitter-types/configure.ac" ]; then (cd "twitter-types" && autoreconf -i); fi
- if [ -f "twitter-types-lens/configure.ac" ]; then (cd "twitter-types-lens" && autoreconf -i); fi
- ${CABAL} v2-freeze -w ${HC} ${TEST} ${BENCH} | color_cabal_output
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
- rm cabal.project.freeze
- ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
- ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
script:
- travis_wait stack --no-terminal --skip-ghc-check test
- stack sdist
- chmod 755 ./attic/check-sdist.sh
- ./attic/check-sdist.sh twitter-types
- ./attic/check-sdist.sh twitter-types-lens
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# Packaging...
- ${CABAL} v2-sdist all | color_cabal_output
# Unpacking...
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
- cd ${DISTDIR} || false
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
# Generate cabal.project
- rm -rf cabal.project cabal.project.local cabal.project.freeze
- touch cabal.project
- |
echo 'packages: "twitter-types-*/*.cabal"' >> cabal.project
echo 'packages: "twitter-types-lens-*/*.cabal"' >> cabal.project
- |
echo "write-ghc-environment-files: always" >> cabal.project
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(twitter-types|twitter-types-lens)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true
- cat cabal.project.local || true
# Building...
# this builds all libraries and executables (without tests/benchmarks)
- ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output
# Building with tests and benchmarks...
# build & run tests, build benchmarks
- ${CABAL} v2-build -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
# Testing...
- ${CABAL} v2-test -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
# cabal check...
- (cd twitter-types-* && ${CABAL} -vnormal check)
- (cd twitter-types-lens-* && ${CABAL} -vnormal check)
# haddock...
- ${CABAL} v2-haddock -w ${HC} ${TEST} ${BENCH} all | color_cabal_output
# Building without installed constraints for packages in global-db...
- rm -f cabal.project.local
- ${CABAL} v2-build -w ${HC} --disable-tests --disable-benchmarks all | color_cabal_output

cache:
directories:
- ~/.stack
# REGENDATA ["cabal.project"]
# EOF

notifications:
slack:
Expand Down
8 changes: 0 additions & 8 deletions .travis/stack-lts-2.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions .travis/stack-lts-3.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions .travis/stack-lts-5.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions .travis/stack-lts-6.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions .travis/stack-lts-7.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions attic/check-sdist.sh

This file was deleted.

3 changes: 3 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages:
twitter-types/
twitter-types-lens/
3 changes: 3 additions & 0 deletions twitter-types-lens/twitter-types-lens.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: twitter-types-lens
version: 0.7.2
synopsis: Twitter JSON types (lens powered)
description: Please see the README on Github at <https://github.com/himura/twitter-types#readme>
homepage: https://github.com/himura/twitter-types
license: BSD3
license-file: LICENSE
Expand All @@ -10,6 +11,8 @@ category: Web
build-type: Simple
cabal-version: >=1.10

tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5

source-repository head
type: git
location: git://github.com/himura/twitter-types.git
Expand Down
9 changes: 7 additions & 2 deletions twitter-types/twitter-types.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ license-file: LICENSE
author: Takahiro HIMURA
maintainer: Takahiro HIMURA <[email protected]>
synopsis: Twitter JSON parser and types
description: This package uses enumerator package for access Twitter API.
description: Please see the README on Github at <https://github.com/himura/twitter-types#readme>
category: Web
stability: Experimental
cabal-version: >= 1.8
build-type: Simple
cabal-version: >= 1.10
homepage: https://github.com/himura/twitter-types

tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5

extra-source-files:
README.md
tests/fixtures/*.json
Expand All @@ -33,6 +35,8 @@ library
exposed-modules:
Web.Twitter.Types

default-language: Haskell2010

test-suite tests
type: exitcode-stdio-1.0
hs-source-dirs: tests
Expand Down Expand Up @@ -60,3 +64,4 @@ test-suite tests
Instances

ghc-options: -Wall
default-language: Haskell2010

0 comments on commit af76b21

Please sign in to comment.