forked from brendanhay/amazonka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-travis
executable file
·62 lines (46 loc) · 1.44 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
#!/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_primary=( 8.6.5 )
ghc_all=( 8.6.5 )
travis=".travis.yml"
echo "Updating ${travis}"
sed -i -e '/# GENERATED/,/# END GENERATED/d' "${travis}"
echo "# GENERATED" >> "${travis}"
matrix "Generator" ghc_primary gen[@] >> "${travis}"
matrix "Core" ghc_all[@] core[@] >> "${travis}"
matrix "Test" ghc_primary test[@] >> "${travis}"
matrix "Priority" ghc_all[@] priority[@] >> "${travis}"
matrix "Remainder" ghc_primary library[@] >> "${travis}"
matrix "Examples" ghc_primary examples[@] >> "${travis}"
echo "# END GENERATED" >> "${travis}"
echo "Done."