on develop help sign in
gogol/script/generate-travis-config
61 lines 1.4 kB history raw
1#!/usr/bin/env bash
3set -euo pipefail
5docs=( documentation )
6core=( gogol-core gogol )
7examples=( gogol-examples )
9priority_=( compute drive appengine storage oauth2 gmail )
10priority=${priority_[@]/#/gogol-}
12library_=( $(ls -d gogol-*) )
13library=( $(echo ${library_[@]} ${priority[@]} | tr ' ' '\n' | sort | uniq -u) )
15entry() {
16 local ver="$1"
17 local lib="$2"
19cat <<-ENTRY
20 - env: GHCVER=${ver} LIBRARY=${lib}
21 addons: { apt: { packages: [ghc-${ver}], sources: [hvr-ghc] } }
22ENTRY
25matrix() {
26 local title="$1"
27 declare -a versions=("${!2}")
28 declare -a selected=("${!3}")
30cat <<-TITLE
32 # ${title}
33TITLE
35 for lib in ${selected[@]}; do
36 for ver in ${versions[@]}; do
37 entry $ver $lib
38 done
39 done
42ghc_82=( 8.2.2 )
43ghc_84=( 8.4.4 )
44ghc_86=( 8.6.3 )
45ghc_all=( 8.6.3 8.4.4 8.2.2)
47travis=".travis.yml"
49echo "Updating ${travis}"
51sed -i -e '/# GENERATED/,/# END GENERATED/d' "${travis}"
53echo "# GENERATED" >> "${travis}"
54matrix "Documentation" ghc_82[@] docs[@] >> "${travis}"
55matrix "Core" ghc_all[@] core[@] >> "${travis}"
56matrix "Priority" ghc_all[@] priority[@] >> "${travis}"
57matrix "Remainder" ghc_82[@] library[@] >> "${travis}"
58matrix "Examples" ghc_82[@] examples[@] >> "${travis}"
59echo "# END GENERATED" >> "${travis}"
61echo "Done."