forked from agda/agda-stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
196 lines (171 loc) · 7 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
language: c
branches:
only:
- master
- experimental
dist: xenial
matrix:
include:
- env:
GHC_VER=8.4.4
CABAL_VER=2.2
ALEX_VER=3.2.5
HAPPY_VER=1.19.12
addons:
apt:
packages:
- cabal-install-2.2
- ghc-8.4.4
sources:
- hvr-ghc
cache:
directories:
- $HOME/.cabsnap
before_install:
- export PATH=/opt/ghc/$GHC_VER/bin:/opt/cabal/$CABAL_VER/bin:/opt/alex/$ALEX_VER/bin:/opt/happy/$HAPPY_VER/bin:~/.cabal/bin/:$PATH;
install:
- cabal update
- sed -i 's/^jobs:/-- jobs:/' $HOME/.cabal/config
# installing dependencies
- cabal install alex-$ALEX_VER happy-$HAPPY_VER cpphs
# installing Agda
# Even if there seems to be duplicated code for master & experimental,
# DO NOT refactor: they regularly get out of sync (typically master
# builds with the released version while experimental uses some dev
# version).
# No matter the path, we should generate a $HOME/installplan.txt to
# check whether the cache needs updating.
- if [[ $TRAVIS_BRANCH = "master" ]]; then
cd ../ &&
git clone https://github.com/agda/agda &&
cd agda &&
git checkout tags/v2.6.1 &&
cabal install --only-dependencies --dry -v > $HOME/installplan.txt ;
fi
- if [[ $TRAVIS_BRANCH = "experimental" ]]; then
cd ../ &&
git clone https://github.com/agda/agda &&
cd agda &&
git checkout c2d5ec4b2403c68d615b81258d6131774e492797 &&
cabal install --only-dependencies --dry -v > $HOME/installplan.txt ;
fi
# checking whether .ghc is still valid
- sed -i -e '1,/^Resolving /d' $HOME/installplan.txt; cat $HOME/installplan.txt
- touch $HOME/.cabsnap/installplan.txt
- mkdir -p $HOME/.cabsnap/ghc $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin
- if diff -u $HOME/.cabsnap/installplan.txt $HOME/installplan.txt;
then
echo "cabal build-cache HIT";
rm -rfv .ghc;
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
else
echo "cabal build-cache MISS";
rm -rf $HOME/.cabsnap;
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
fi
- if [[ $TRAVIS_BRANCH = "master" ]]; then
cabal install ;
fi
- if [[ $TRAVIS_BRANCH = "experimental" ]]; then
cabal install ;
fi
# snapshot package-db on cache miss
- echo "snapshotting package-db to build-cache";
mkdir $HOME/.cabsnap;
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin $HOME/installplan.txt $HOME/.cabsnap/;
- if [[ $TRAVIS_BRANCH = "master" ]]; then
cd ../ ;
fi
- if [[ $TRAVIS_BRANCH = "experimental" ]]; then
cd ../ ;
fi
# installing fix-whitespace
- git clone https://github.com/agda/fix-whitespace --depth=1
- cd fix-whitespace
- cabal install fix-whitespace.cabal
- cd ../
# generating Everything.agda
- cd agda-stdlib
- cabal install lib.cabal
- runghc GenerateEverything.hs
# setting up travis-specific scripts and files
- cp travis/* .
before_script:
- export AGDA_OPTIONS="-Werror"
- export RTS_OPTIONS="+RTS -M3.5G -H3.5G -A128M -RTS"
script:
# generating index.agda
- ./index.sh
# detecting whitespace violations
- fix-whitespace --check
# expose the value of OPTIONS
- echo $AGDA_OPTIONS
- echo $RTS_OPTIONS
# checking safe modules build with --safe
- agda $AGDA_OPTIONS $RTS_OPTIONS -i . -i src/ --safe EverythingSafeGuardedness.agda
- agda $AGDA_OPTIONS $RTS_OPTIONS -i . -i src/ --safe EverythingSafeSizedTypes.agda
# detecting basic compilation errors
- agda $AGDA_OPTIONS $RTS_OPTIONS -i . -i src/ -c --no-main Everything.agda
# compiling & running the examples using the FFI
- agda $AGDA_OPTIONS $RTS_OPTIONS -i . -i src/ -c README/Foreign/Haskell.agda && ./Haskell
# building the docs
- agda $AGDA_OPTIONS $RTS_OPTIONS -i . -i src/ --html safe.agda
- agda $AGDA_OPTIONS $RTS_OPTIONS -i . -i src/ --html index.agda
# moving everything to the appropriate directory
- if [[ $TRAVIS_BRANCH = "master" ]]; then
mv html/* . ;
fi
- if [[ $TRAVIS_BRANCH = "experimental" ]]; then
mv html/* experimental/ ;
fi
after_success:
# uploading to gh-pages
- git init
- git config --global user.name "Travis CI bot"
- git config --global user.email "[email protected]"
- git remote add upstream https://[email protected]/agda/agda-stdlib.git &>/dev/null
- git fetch upstream && git reset upstream/gh-pages
- if [[ $TRAVIS_BRANCH = "master" ]]; then
git checkout HEAD -- v0.16/ v0.17/ v1.0/ v1.1/ v1.2/ experimental/ ;
fi
- if [[ $TRAVIS_BRANCH = "experimental" ]]; then
git checkout HEAD -- *.html v0.16/ v0.17/ v1.0/ v1.1/ v1.2/ ;
fi
- git add -f \*.html
- git commit -m "Automatic HTML update via Travis"
- if [[ $TRAVIS_PULL_REQUEST = "false" && ($TRAVIS_BRANCH = "master" || $TRAVIS_BRANCH = "experimental") ]]; then
git push -q upstream HEAD:gh-pages &>/dev/null;
fi
notifications:
email: false
- stage: stack
env:
GHC_VER=8.4.4
cache:
directories:
- $HOME/.stack
- $TRAVIS_BUILD_DIR/.stack-work
- $HOME/.local/bin
before_install:
# Install ghc
- sudo -E apt-add-repository -y "ppa:hvr/ghc" &&
travis_apt_get_update &&
sudo -E apt-get -yq --no-install-suggests --no-install-recommends install ghc-${GHC_VER} &&
export PATH=/opt/ghc/$GHC_VER/bin:$PATH
# Install stack
- 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'
# Set up arguments and flags for stack compilation
- export ARGS="--stack-yaml stack-${GHC_VER}.yaml --no-terminal --system-ghc"
- echo "*** GHC version ***" && ghc --version &&
echo "*** Stack version ***" && stack --version
install:
- stack ${ARGS} build
script:
- stack ${ARGS} exec -- GenerateEverything
- stack ${ARGS} exec -- AllNonAsciiChars
before_cache:
- find ${TRAVIS_BUILD_DIR}/.stack-work -type f -name '*.agdai' -delete
after_success: []