Skip to content

Commit 4f1d712

Browse files
dmjiochessai
authored andcommitted
Add .travis.yml
- use haskell-ci - download arrayfire installer and unpack to /opt/arrayfire/
1 parent c4e4aca commit 4f1d712

File tree

4 files changed

+164
-11
lines changed

4 files changed

+164
-11
lines changed

Diff for: .travis.yml

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# This Travis job script has been generated by a script via
2+
#
3+
# haskell-ci 'travis' 'arrayfire.cabal'
4+
#
5+
# For more information, see https://github.com/haskell-CI/haskell-ci
6+
#
7+
# version: 0.3.20190814
8+
#
9+
language: c
10+
dist: xenial
11+
sudo: required
12+
git:
13+
# whether to recursively clone submodules
14+
submodules: false
15+
cache:
16+
directories:
17+
- $HOME/.cabal/packages
18+
- $HOME/.cabal/store
19+
before_cache:
20+
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
21+
# remove files that are regenerated by 'cabal update'
22+
- rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
23+
- rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
24+
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
25+
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
26+
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
27+
- rm -rfv $CABALHOME/packages/head.hackage
28+
matrix:
29+
include:
30+
- compiler: ghc-8.8.1
31+
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}
32+
#- compiler: ghc-8.6.5
33+
# addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-2.4"]}}
34+
#- compiler: ghc-8.4.4
35+
# addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-2.4"]}}
36+
#- compiler: ghc-8.2.2
37+
# addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-2.4"]}}
38+
before_install:
39+
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
40+
- WITHCOMPILER="-w $HC"
41+
- HCPKG="$HC-pkg"
42+
- unset CC
43+
- CABAL=/opt/ghc/bin/cabal
44+
- CABALHOME=$HOME/.cabal
45+
- export PATH="$CABALHOME/bin:$PATH"
46+
- TOP=$(pwd)
47+
- "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
48+
- echo $HCNUMVER
49+
- CABAL="$CABAL -vnormal+nowrap+markoutput"
50+
- set -o pipefail
51+
- |
52+
echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
53+
echo 'BEGIN { state = "output"; }' >> .colorful.awk
54+
echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
55+
echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
56+
echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
57+
echo ' if (state == "cabal") {' >> .colorful.awk
58+
echo ' print blue($0)' >> .colorful.awk
59+
echo ' } else {' >> .colorful.awk
60+
echo ' print $0' >> .colorful.awk
61+
echo ' }' >> .colorful.awk
62+
echo '}' >> .colorful.awk
63+
- cat .colorful.awk
64+
- |
65+
color_cabal_output () {
66+
awk -f $TOP/.colorful.awk
67+
}
68+
- echo text | color_cabal_output
69+
install:
70+
- echo "Downloading ArrayFire-3.6.4"
71+
- curl -O http://arrayfire.s3.amazonaws.com/3.6.4/ArrayFire-v3.6.4_Linux_x86_64.sh
72+
- chmod +x ArrayFire-v3.6.4_Linux_x86_64.sh
73+
- ./ArrayFire-v3.6.4_Linux_x86_64.sh --include-subdir --prefix=/opt
74+
- ls -lah /opt/arrayfire/
75+
- ${CABAL} --version
76+
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
77+
- TEST=--enable-tests
78+
- BENCH=--enable-benchmarks
79+
- HEADHACKAGE=false
80+
- rm -f $CABALHOME/config
81+
- |
82+
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
83+
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
84+
echo "write-ghc-environment-files: always" >> $CABALHOME/config
85+
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
86+
echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
87+
echo "world-file: $CABALHOME/world" >> $CABALHOME/config
88+
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
89+
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
90+
echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
91+
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
92+
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
93+
echo "install-dirs user" >> $CABALHOME/config
94+
echo " prefix: $CABALHOME" >> $CABALHOME/config
95+
echo "repository hackage.haskell.org" >> $CABALHOME/config
96+
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
97+
- cat $CABALHOME/config
98+
- rm -fv cabal.project cabal.project.local cabal.project.freeze
99+
- travis_retry ${CABAL} v2-update -v
100+
# Generate cabal.project
101+
- rm -rf cabal.project cabal.project.local cabal.project.freeze
102+
- touch cabal.project
103+
- |
104+
echo "packages: ." >> cabal.project
105+
- |
106+
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(arrayfire)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
107+
- cat cabal.project || true
108+
- cat cabal.project.local || true
109+
- ${CABAL} install $WITHCOMPILER hspec-discover | color_cabal_output # needed on $PATH for tests
110+
- if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
111+
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
112+
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
113+
- rm cabal.project.freeze
114+
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
115+
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
116+
script:
117+
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
118+
# Packaging...
119+
- ${CABAL} v2-sdist all | color_cabal_output
120+
# Unpacking...
121+
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
122+
- cd ${DISTDIR} || false
123+
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
124+
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
125+
- PKGDIR_arrayfire="$(find . -maxdepth 1 -type d -regex '.*/arrayfire-[0-9.]*')"
126+
# Generate cabal.project
127+
- rm -rf cabal.project cabal.project.local cabal.project.freeze
128+
- touch cabal.project
129+
- |
130+
echo "packages: ${PKGDIR_arrayfire}" >> cabal.project
131+
- |
132+
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(arrayfire)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
133+
- cat cabal.project || true
134+
- cat cabal.project.local || true
135+
# Building...
136+
# this builds all libraries and executables (without tests/benchmarks)
137+
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
138+
# Building with tests and benchmarks...
139+
# build & run tests, build benchmarks
140+
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
141+
# Testing...
142+
- ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
143+
# cabal check...
144+
- (cd ${PKGDIR_arrayfire} && ${CABAL} -vnormal check)
145+
# haddock...
146+
- ${CABAL} v2-haddock $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
147+
# Building without installed constraints for packages in global-db...
148+
- rm -f cabal.project.local
149+
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
150+
151+
# REGENDATA ["travis","arrayfire.cabal"]
152+
# EOF

Diff for: Setup.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Main where
22

3-
import Distribution.Extra.Doctest (defaultMainWithDoctests)
3+
import Distribution.Simple
44

55
main :: IO ()
6-
main = defaultMainWithDoctests "doctests"
6+
main = defaultMain

Diff for: arrayfire.cabal

+6-9
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,20 @@ author: David Johnson
88
maintainer: [email protected]
99
copyright: David Johnson (c) 2018-2020
1010
category: Math
11-
build-type: Custom
11+
build-type: Simple
1212
extra-source-files: CHANGELOG.md
1313
cabal-version: >=1.10
1414
description: High-level Haskell bindings to the ArrayFire General-purpose GPU library
1515
.
1616
<<https://user-images.githubusercontent.com/875324/59819388-9ff83f00-92f5-11e9-9ac0-51eef200c716.png>>
1717
.
18+
tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1
1819

1920
flag disable-default-paths
2021
description: When enabled, don't add default hardcoded include/link dirs by default. Needed for hermetic builds like in nix.
2122
default: False
2223
manual: True
2324

24-
custom-setup
25-
setup-depends:
26-
base <5,
27-
Cabal,
28-
cabal-doctest >=1 && <1.1
29-
3025
library
3126
exposed-modules:
3227
ArrayFire
@@ -94,9 +89,11 @@ library
9489
include-dirs:
9590
/opt/arrayfire/include
9691
extra-lib-dirs:
92+
/opt/arrayfire/lib64
9793
/opt/arrayfire/lib
98-
ld-options:
99-
-Wl,-rpath /opt/arrayfire/lib
94+
-- ld-options:
95+
-- -Wl,-rpath /opt/arrayfire/lib
96+
-- -Wl,-rpath /opt/arrayfire/lib64
10097

10198
executable main
10299
hs-source-dirs:

Diff for: shell.nix

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ in
1616
'cabal v1-configure --enable-tests && \
1717
cabal v1-build test && dist/build/test/test'
1818
}
19+
function test () {
20+
cabal v1-configure --enable-tests && \
21+
cabal v1-build test && dist/build/test/test
22+
}
1923
function doctest-runner () {
2024
${pkgs.ag}/bin/ag -l | \
2125
${pkgs.entr}/bin/entr sh -c \

0 commit comments

Comments
 (0)