forked from brendanhay/amazonka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-travis
executable file
·63 lines (47 loc) · 1.46 KB
/
generate-travis
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
#!/usr/bin/env bash
set -euo pipefail
gen=( amazonka-gen )
core=( amazonka-core amazonka )
test=( amazonka-test )
examples=( amazonka-examples )
priority_=( s3 dynamodb emr )
priority=${priority_[@]/#/amazonka-}
library_=( $(ls -d amazonka-*) )
library=( $(echo ${library_[@]} ${priority[@]} | tr ' ' '\n' | sort | uniq -u) )
entry() {
local ver="$1"
local lib="$2"
cat <<-ENTRY
- env: LIBRARY=${lib} GHCVER=${ver} STACK_YAML=stack-${ver}.yaml CACHE_NAME=${lib}-${ver}
compiler: ": #stack ${ver}"
addons: {apt: {packages: [ghc-${ver}], sources: [hvr-ghc]}}
ENTRY
}
matrix() {
local title="$1"
declare -a versions=("${!2}")
declare -a selected=("${!3}")
cat <<-TITLE
# ${title}
TITLE
for lib in ${selected[@]}; do
for ver in ${versions[@]}; do
entry $ver $lib
done
done
}
ghc_802=( 8.0.2 )
ghc_822=( 8.2.2 )
ghc_all=( 8.2.2 8.0.2 7.10.3 )
travis=".travis.yml"
echo "Updating ${travis}"
sed -i -e '/# GENERATED/,/# END GENERATED/d' "${travis}"
echo "# GENERATED" >> "${travis}"
matrix "Generator" ghc_822[@] gen[@] >> "${travis}"
matrix "Core" ghc_all[@] core[@] >> "${travis}"
matrix "Test" ghc_822[@] test[@] >> "${travis}"
matrix "Priority" ghc_all[@] priority[@] >> "${travis}"
matrix "Remainder" ghc_822[@] library[@] >> "${travis}"
matrix "Examples" ghc_822[@] examples[@] >> "${travis}"
echo "# END GENERATED" >> "${travis}"
echo "Done."