Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9b7342

Browse files
authored
Merge pull request haskell-github#299 from phadej/build-tool-depends
Add build-tool-depends, regenerate .travis.yml
2 parents 437c6ca + 72ac073 commit f9b7342

File tree

2 files changed

+48
-48
lines changed

2 files changed

+48
-48
lines changed

.travis.yml

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This Travis job script has been generated by a script via
22
#
3-
# make_travis_yml_2.hs 'github.cabal'
3+
# make_travis_yml_2.hs '--branch' 'master' '-o' '.travis.yml' 'github.cabal'
44
#
55
# For more information, see https://github.com/hvr/multi-ghc-travis
66
#
@@ -10,11 +10,14 @@ sudo: false
1010
git:
1111
submodules: false # whether to recursively clone submodules
1212

13+
branches:
14+
only:
15+
- master
16+
1317
cache:
1418
directories:
1519
- $HOME/.cabal/packages
1620
- $HOME/.cabal/store
17-
- $HOME/.local/bin
1821

1922
before_cache:
2023
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
@@ -41,59 +44,55 @@ matrix:
4144
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
4245

4346
before_install:
44-
- HC=${CC}
45-
- unset CC
46-
- PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
47-
- PKGNAME='github'
47+
- HC=${CC}
48+
- HCPKG=${HC/ghc/ghc-pkg}
49+
- unset CC
50+
- PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH
4851

4952
install:
50-
- ROOTDIR=$(pwd)
51-
- cabal --version
52-
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
53-
- BENCH=${BENCH---enable-benchmarks}
54-
- TEST=${TEST---enable-tests}
55-
- travis_retry cabal update -v
56-
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
57-
- sh install-hspec-discover.sh # TEMP, before we get cabal new-install
58-
- rm -fv cabal.project.local
59-
- "echo 'packages: .' > cabal.project"
60-
- rm -f cabal.project.freeze
61-
- cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all
62-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all
53+
- cabal --version
54+
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
55+
- BENCH=${BENCH---enable-benchmarks}
56+
- TEST=${TEST---enable-tests}
57+
- HADDOCK=${HADDOCK-true}
58+
- INSTALLED=${INSTALLED-true}
59+
- travis_retry cabal update -v
60+
- sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
61+
- rm -fv cabal.project.local
62+
- "echo 'packages: .' > cabal.project"
63+
- if [ -f "./configure.ac" ]; then
64+
(cd "."; autoreconf -i);
65+
fi
66+
- rm -f cabal.project.freeze
67+
- cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
68+
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
69+
- rm -rf "."/.ghc.environment.* "."/dist
70+
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
6371

6472
# Here starts the actual work to be performed for the package under test;
6573
# any command which exits with a non-zero exit code causes the build to fail.
6674
script:
67-
- if [ -f configure.ac ]; then autoreconf -i; fi
68-
- rm -rf .ghc.environment.* dist/
69-
- cabal sdist # test that a source-distribution can be generated
70-
- cd dist/
71-
- SRCTAR=(${PKGNAME}-*.tar.gz)
72-
- SRC_BASENAME="${SRCTAR/%.tar.gz}"
73-
- tar -xvf "./$SRC_BASENAME.tar.gz"
74-
- cd "$SRC_BASENAME/"
75-
## from here on, CWD is inside the extracted source-tarball
76-
- rm -fv cabal.project.local
77-
- "echo 'packages: . samples' > cabal.project"
78-
- cp -r $ROOTDIR/samples .
79-
# this builds all libraries and executables (without tests/benchmarks)
80-
- rm -f cabal.project.freeze
81-
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
82-
# this builds all libraries and executables (including tests/benchmarks)
83-
# - rm -rf ./dist-newstyle
75+
# test that source-distributions can be generated
76+
- (cd "."; cabal sdist)
77+
- mv "."/dist/github-*.tar.gz ${DISTDIR}/
78+
- cd ${DISTDIR}
79+
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
80+
- "printf 'packages: github-*/*.cabal\n' > cabal.project"
81+
# this builds all libraries and executables (without tests/benchmarks)
82+
- cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
8483

85-
# build & run tests
86-
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
87-
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
84+
# Build with installed constraints for packages in global-db
85+
- if $INSTALLED; then
86+
echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh;
87+
else echo "Not building with installed constraints"; fi
8888

89-
# run samples
90-
- for sample in show-user list-followers list-following operational; do
91-
echo "=== SAMPLE $sample ===";
92-
$(find dist-newstyle/ -type f -name github-$sample);
93-
done
89+
# build & run tests, build benchmarks
90+
- cabal new-build -w ${HC} ${TEST} ${BENCH} all
91+
- if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi
9492

95-
# EOF
93+
# haddock
94+
- rm -rf ./dist-newstyle
95+
- if $HADDOCK; then cabal new-haddock -w ${HC} --disable-tests --disable-benchmarks all; else echo "Skipping haddock generation";fi
9696

97-
branches:
98-
only:
99-
- master
97+
# REGENDATA ["--branch","master","-o",".travis.yml","github.cabal"]
98+
# EOF

github.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ test-suite github-test
182182
GitHub.EventsSpec
183183
main-is: Spec.hs
184184
ghc-options: -Wall
185+
build-tool-depends: hspec-discover:hspec-discover
185186
build-depends: base,
186187
base-compat,
187188
github,

0 commit comments

Comments
 (0)