-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5ccb35
commit 94a8f6b
Showing
11 changed files
with
195 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,143 @@ | ||
# Copy these contents into the root directory of your Github project in a file | ||
# named .travis.yml | ||
|
||
# Use new container infrastructure to enable caching | ||
sudo: false | ||
|
||
# Choose a lightweight base image; we provide our own build tools. | ||
# This Travis job script has been generated by a script via | ||
# | ||
# haskell-ci 'cabal.project' '--output' '.travis.yml' | ||
# | ||
# For more information, see https://github.com/haskell-CI/haskell-ci | ||
# | ||
# version: 0.3.20190521 | ||
# | ||
language: c | ||
|
||
# Caching so the next build will be fast too. | ||
dist: xenial | ||
git: | ||
# whether to recursively clone submodules | ||
submodules: false | ||
cache: | ||
directories: | ||
- $HOME/.ghc | ||
- $HOME/.cabal | ||
- $HOME/.stack | ||
|
||
# The different configurations we want to test. We have BUILD=cabal which uses | ||
# cabal-install, and BUILD=stack which uses Stack. More documentation on each | ||
# of those below. | ||
# | ||
# We set the compiler values here to tell Travis to use a different | ||
# cache file per set of arguments. | ||
# | ||
# If you need to have different apt packages for each combination in the | ||
# matrix, you can use a line such as: | ||
# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}} | ||
- $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: | ||
# We grab the appropriate GHC and cabal-install versions from hvr's PPA. See: | ||
# https://github.com/hvr/multi-ghc-travis | ||
- env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7 | ||
compiler: ": #GHC 7.8.4" | ||
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} | ||
- env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7 | ||
compiler: ": #GHC 7.10.3" | ||
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} | ||
- env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 | ||
compiler: ": #GHC 8.0.1" | ||
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} | ||
|
||
# Build with the newest GHC and cabal-install. This is an accepted failure, | ||
# see below. | ||
- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7 | ||
compiler: ": #GHC HEAD" | ||
addons: {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} | ||
|
||
# The Stack builds. We can pass in arbitrary Stack arguments via the ARGS | ||
# variable, such as using --stack-yaml to point to a different file. | ||
- env: BUILD=stack ARGS="" | ||
compiler: ": #stack default" | ||
addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} | ||
|
||
- env: BUILD=stack ARGS="--resolver lts-2" | ||
compiler: ": #stack 7.8.4" | ||
addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}} | ||
|
||
- env: BUILD=stack ARGS="--resolver lts-3" | ||
compiler: ": #stack 7.10.2" | ||
addons: {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc]}} | ||
|
||
- env: BUILD=stack ARGS="--resolver lts-5" | ||
compiler: ": #stack 7.10.3" | ||
addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} | ||
|
||
# Nightly builds are allowed to fail | ||
- env: BUILD=stack ARGS="--resolver nightly" | ||
compiler: ": #stack nightly" | ||
addons: {apt: {packages: [libgmp,libgmp-dev]}} | ||
|
||
allow_failures: | ||
- env: BUILD=cabal GHCVER=head CABALVER=head | ||
- env: BUILD=stack ARGS="--resolver nightly" | ||
|
||
- compiler: ghc-8.6.3 | ||
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.3","cabal-install-2.4"]}} | ||
before_install: | ||
# Using compiler above sets CC to an invalid value, so unset it | ||
- unset CC | ||
|
||
# We want to always allow newer versions of packages when building on GHC HEAD | ||
- CABALARGS="" | ||
- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi | ||
|
||
# add the corresponding paths for cabal | ||
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:/opt/alex/$ALEXVER/bin:/opt/happy/$HAPPYVER/bin:$HOME/.cabal/bin:$PATH | ||
|
||
# create stack folder, path and populate it with the stack executable | ||
- 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' | ||
- stack --version | ||
|
||
# this is needed so cabal can find the newest packages | ||
- | | ||
if [ "$BUILD" = "cabal" ] | ||
then | ||
cabal update | ||
fi | ||
- 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: | ||
- echo "Installing..." | ||
- | | ||
case "$BUILD" in | ||
stack) | ||
stack clean | ||
stack --no-terminal $ARGS --install-ghc setup | ||
;; | ||
cabal) | ||
cabal sandbox init | ||
cabal sandbox add-source Magic | ||
cabal sandbox add-source Magic-Cards | ||
cabal sandbox add-source Magic-CLI | ||
cabal sandbox add-source Magic-Web-Server | ||
cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls Magic Magic-Cards Magic-CLI Magic-Web-Server $CABALARGS | ||
esac | ||
- ${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: "Magic"' >> cabal.project | ||
echo 'packages: "Magic-Cards"' >> cabal.project | ||
echo 'packages: "Magic-CLI"' >> cabal.project | ||
- | | ||
echo "write-ghc-environment-files: always" >> cabal.project | ||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(Magic|Magic-CLI|Magic-Cards)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" | ||
- cat cabal.project || true | ||
- cat cabal.project.local || true | ||
- if [ -f "Magic/configure.ac" ]; then (cd "Magic" && autoreconf -i); fi | ||
- if [ -f "Magic-Cards/configure.ac" ]; then (cd "Magic-Cards" && autoreconf -i); fi | ||
- if [ -f "Magic-CLI/configure.ac" ]; then (cd "Magic-CLI" && 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: | ||
- echo "Running tests..." | ||
- | | ||
case "$BUILD" in | ||
stack) | ||
stack clean | ||
stack --no-terminal $ARGS --skip-ghc-check test | ||
;; | ||
cabal) | ||
cabal install --enable-tests --enable-benchmarks --force-reinstalls Magic Magic-Cards Magic-CLI Magic-Web-Server $CABALARGS | ||
esac | ||
- 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: "Magic-*/*.cabal"' >> cabal.project | ||
echo 'packages: "Magic-Cards-*/*.cabal"' >> cabal.project | ||
echo 'packages: "Magic-CLI-*/*.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 -- '^(Magic|Magic-CLI|Magic-Cards)$' || 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 | ||
# cabal check... | ||
- (cd Magic-* && ${CABAL} -vnormal check) | ||
- (cd Magic-Cards-* && ${CABAL} -vnormal check) | ||
- (cd Magic-CLI-* && ${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 | ||
|
||
# REGENDATA ["cabal.project","--output",".travis.yml"] | ||
# EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ maintainer: [email protected] | |
category: Game | ||
build-type: Simple | ||
cabal-version: >=1.8 | ||
tested-with: GHC ==8.6.3 | ||
|
||
executable magic-cli | ||
hs-source-dirs: src | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ maintainer: [email protected] | |
category: Game | ||
build-type: Simple | ||
cabal-version: >=1.8 | ||
tested-with: GHC ==8.6.3 | ||
|
||
library | ||
hs-source-dirs: src | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ maintainer: [email protected] | |
category: Game | ||
build-type: Simple | ||
cabal-version: >=1.8 | ||
tested-with: GHC ==8.6.3 | ||
|
||
library | ||
hs-source-dirs: src | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.