|
| 1 | +# This GitHub workflow config has been generated by a script via |
| 2 | +# |
| 3 | +# haskell-ci 'github' 'cassava.cabal' |
| 4 | +# |
| 5 | +# To regenerate the script (for example after adjusting tested-with) run |
| 6 | +# |
| 7 | +# haskell-ci regenerate |
| 8 | +# |
| 9 | +# For more information, see https://github.com/haskell-CI/haskell-ci |
| 10 | +# |
| 11 | +# version: 0.13.20211030 |
| 12 | +# |
| 13 | +# REGENDATA ("0.13.20211030",["github","cassava.cabal"]) |
| 14 | +# |
| 15 | +name: Haskell-CI |
| 16 | +on: |
| 17 | + - push |
| 18 | + - pull_request |
| 19 | +jobs: |
| 20 | + linux: |
| 21 | + name: Haskell-CI - Linux - ${{ matrix.compiler }} |
| 22 | + runs-on: ubuntu-18.04 |
| 23 | + container: |
| 24 | + image: buildpack-deps:bionic |
| 25 | + continue-on-error: ${{ matrix.allow-failure }} |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + include: |
| 29 | + - compiler: ghc-9.2.1 |
| 30 | + compilerKind: ghc |
| 31 | + compilerVersion: 9.2.1 |
| 32 | + setup-method: ghcup |
| 33 | + allow-failure: false |
| 34 | + - compiler: ghc-9.0.1 |
| 35 | + compilerKind: ghc |
| 36 | + compilerVersion: 9.0.1 |
| 37 | + setup-method: hvr-ppa |
| 38 | + allow-failure: false |
| 39 | + - compiler: ghc-8.10.7 |
| 40 | + compilerKind: ghc |
| 41 | + compilerVersion: 8.10.7 |
| 42 | + setup-method: ghcup |
| 43 | + allow-failure: false |
| 44 | + - compiler: ghc-8.8.4 |
| 45 | + compilerKind: ghc |
| 46 | + compilerVersion: 8.8.4 |
| 47 | + setup-method: hvr-ppa |
| 48 | + allow-failure: false |
| 49 | + - compiler: ghc-8.6.5 |
| 50 | + compilerKind: ghc |
| 51 | + compilerVersion: 8.6.5 |
| 52 | + setup-method: hvr-ppa |
| 53 | + allow-failure: false |
| 54 | + - compiler: ghc-8.4.4 |
| 55 | + compilerKind: ghc |
| 56 | + compilerVersion: 8.4.4 |
| 57 | + setup-method: hvr-ppa |
| 58 | + allow-failure: false |
| 59 | + - compiler: ghc-8.2.2 |
| 60 | + compilerKind: ghc |
| 61 | + compilerVersion: 8.2.2 |
| 62 | + setup-method: hvr-ppa |
| 63 | + allow-failure: false |
| 64 | + - compiler: ghc-8.0.2 |
| 65 | + compilerKind: ghc |
| 66 | + compilerVersion: 8.0.2 |
| 67 | + setup-method: hvr-ppa |
| 68 | + allow-failure: false |
| 69 | + - compiler: ghc-7.10.3 |
| 70 | + compilerKind: ghc |
| 71 | + compilerVersion: 7.10.3 |
| 72 | + setup-method: hvr-ppa |
| 73 | + allow-failure: false |
| 74 | + - compiler: ghc-7.8.4 |
| 75 | + compilerKind: ghc |
| 76 | + compilerVersion: 7.8.4 |
| 77 | + setup-method: hvr-ppa |
| 78 | + allow-failure: false |
| 79 | + - compiler: ghc-7.6.3 |
| 80 | + compilerKind: ghc |
| 81 | + compilerVersion: 7.6.3 |
| 82 | + setup-method: hvr-ppa |
| 83 | + allow-failure: false |
| 84 | + - compiler: ghc-7.4.2 |
| 85 | + compilerKind: ghc |
| 86 | + compilerVersion: 7.4.2 |
| 87 | + setup-method: hvr-ppa |
| 88 | + allow-failure: false |
| 89 | + fail-fast: false |
| 90 | + steps: |
| 91 | + - name: apt |
| 92 | + run: | |
| 93 | + apt-get update |
| 94 | + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 |
| 95 | + if [ "${{ matrix.setup-method }}" = ghcup ]; then |
| 96 | + mkdir -p "$HOME/.ghcup/bin" |
| 97 | + curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup" |
| 98 | + chmod a+x "$HOME/.ghcup/bin/ghcup" |
| 99 | + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" |
| 100 | + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 |
| 101 | + else |
| 102 | + apt-add-repository -y 'ppa:hvr/ghc' |
| 103 | + apt-get update |
| 104 | + apt-get install -y "$HCNAME" |
| 105 | + mkdir -p "$HOME/.ghcup/bin" |
| 106 | + curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup" |
| 107 | + chmod a+x "$HOME/.ghcup/bin/ghcup" |
| 108 | + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 |
| 109 | + fi |
| 110 | + env: |
| 111 | + HCKIND: ${{ matrix.compilerKind }} |
| 112 | + HCNAME: ${{ matrix.compiler }} |
| 113 | + HCVER: ${{ matrix.compilerVersion }} |
| 114 | + - name: Set PATH and environment variables |
| 115 | + run: | |
| 116 | + echo "$HOME/.cabal/bin" >> $GITHUB_PATH |
| 117 | + echo "LANG=C.UTF-8" >> "$GITHUB_ENV" |
| 118 | + echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" |
| 119 | + echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" |
| 120 | + HCDIR=/opt/$HCKIND/$HCVER |
| 121 | + if [ "${{ matrix.setup-method }}" = ghcup ]; then |
| 122 | + HC=$HOME/.ghcup/bin/$HCKIND-$HCVER |
| 123 | + echo "HC=$HC" >> "$GITHUB_ENV" |
| 124 | + echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" |
| 125 | + echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" |
| 126 | + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" |
| 127 | + else |
| 128 | + HC=$HCDIR/bin/$HCKIND |
| 129 | + echo "HC=$HC" >> "$GITHUB_ENV" |
| 130 | + echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" |
| 131 | + echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" |
| 132 | + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" |
| 133 | + fi |
| 134 | +
|
| 135 | + HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') |
| 136 | + echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" |
| 137 | + echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" |
| 138 | + echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" |
| 139 | + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" |
| 140 | + echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" |
| 141 | + echo "GHCJSARITH=0" >> "$GITHUB_ENV" |
| 142 | + env: |
| 143 | + HCKIND: ${{ matrix.compilerKind }} |
| 144 | + HCNAME: ${{ matrix.compiler }} |
| 145 | + HCVER: ${{ matrix.compilerVersion }} |
| 146 | + - name: env |
| 147 | + run: | |
| 148 | + env |
| 149 | + - name: write cabal config |
| 150 | + run: | |
| 151 | + mkdir -p $CABAL_DIR |
| 152 | + cat >> $CABAL_CONFIG <<EOF |
| 153 | + remote-build-reporting: anonymous |
| 154 | + write-ghc-environment-files: never |
| 155 | + remote-repo-cache: $CABAL_DIR/packages |
| 156 | + logs-dir: $CABAL_DIR/logs |
| 157 | + world-file: $CABAL_DIR/world |
| 158 | + extra-prog-path: $CABAL_DIR/bin |
| 159 | + symlink-bindir: $CABAL_DIR/bin |
| 160 | + installdir: $CABAL_DIR/bin |
| 161 | + build-summary: $CABAL_DIR/logs/build.log |
| 162 | + store-dir: $CABAL_DIR/store |
| 163 | + install-dirs user |
| 164 | + prefix: $CABAL_DIR |
| 165 | + repository hackage.haskell.org |
| 166 | + url: http://hackage.haskell.org/ |
| 167 | + EOF |
| 168 | + cat $CABAL_CONFIG |
| 169 | + - name: versions |
| 170 | + run: | |
| 171 | + $HC --version || true |
| 172 | + $HC --print-project-git-commit-id || true |
| 173 | + $CABAL --version || true |
| 174 | + - name: update cabal index |
| 175 | + run: | |
| 176 | + $CABAL v2-update -v |
| 177 | + - name: install cabal-plan |
| 178 | + run: | |
| 179 | + mkdir -p $HOME/.cabal/bin |
| 180 | + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz |
| 181 | + echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - |
| 182 | + xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan |
| 183 | + rm -f cabal-plan.xz |
| 184 | + chmod a+x $HOME/.cabal/bin/cabal-plan |
| 185 | + cabal-plan --version |
| 186 | + - name: checkout |
| 187 | + uses: actions/checkout@v2 |
| 188 | + with: |
| 189 | + path: source |
| 190 | + - name: initial cabal.project for sdist |
| 191 | + run: | |
| 192 | + touch cabal.project |
| 193 | + echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project |
| 194 | + cat cabal.project |
| 195 | + - name: sdist |
| 196 | + run: | |
| 197 | + mkdir -p sdist |
| 198 | + $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist |
| 199 | + - name: unpack |
| 200 | + run: | |
| 201 | + mkdir -p unpacked |
| 202 | + find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; |
| 203 | + - name: generate cabal.project |
| 204 | + run: | |
| 205 | + PKGDIR_cassava="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/cassava-[0-9.]*')" |
| 206 | + echo "PKGDIR_cassava=${PKGDIR_cassava}" >> "$GITHUB_ENV" |
| 207 | + rm -f cabal.project cabal.project.local |
| 208 | + touch cabal.project |
| 209 | + touch cabal.project.local |
| 210 | + echo "packages: ${PKGDIR_cassava}" >> cabal.project |
| 211 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package cassava" >> cabal.project ; fi |
| 212 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi |
| 213 | + cat >> cabal.project <<EOF |
| 214 | + EOF |
| 215 | + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(cassava)$/; }' >> cabal.project.local |
| 216 | + cat cabal.project |
| 217 | + cat cabal.project.local |
| 218 | + - name: dump install plan |
| 219 | + run: | |
| 220 | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all |
| 221 | + cabal-plan |
| 222 | + - name: cache |
| 223 | + uses: actions/cache@v2 |
| 224 | + with: |
| 225 | + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} |
| 226 | + path: ~/.cabal/store |
| 227 | + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- |
| 228 | + - name: install dependencies |
| 229 | + run: | |
| 230 | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all |
| 231 | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all |
| 232 | + - name: build w/o tests |
| 233 | + run: | |
| 234 | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all |
| 235 | + - name: build |
| 236 | + run: | |
| 237 | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always |
| 238 | + - name: tests |
| 239 | + run: | |
| 240 | + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct |
| 241 | + - name: cabal check |
| 242 | + run: | |
| 243 | + cd ${PKGDIR_cassava} || false |
| 244 | + ${CABAL} -vnormal check |
| 245 | + - name: haddock |
| 246 | + run: | |
| 247 | + $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all |
| 248 | + - name: unconstrained build |
| 249 | + run: | |
| 250 | + rm -f cabal.project.local |
| 251 | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all |
0 commit comments