|
| 1 | +# This GitHub workflow config has been generated by a script via |
| 2 | +# |
| 3 | +# haskell-ci 'github' 'cabal.project' |
| 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.15.20220710 |
| 12 | +# |
| 13 | +# REGENDATA ("0.15.20220710",["github","cabal.project"]) |
| 14 | +# |
| 15 | +name: Haskell-CI |
| 16 | +on: |
| 17 | + push: |
| 18 | + branches: |
| 19 | + - master |
| 20 | + - ci* |
| 21 | + pull_request: |
| 22 | + branches: |
| 23 | + - master |
| 24 | + - ci* |
| 25 | +jobs: |
| 26 | + linux: |
| 27 | + name: Haskell-CI - Linux - ${{ matrix.compiler }} |
| 28 | + runs-on: ubuntu-20.04 |
| 29 | + timeout-minutes: |
| 30 | + 60 |
| 31 | + container: |
| 32 | + image: buildpack-deps:bionic |
| 33 | + continue-on-error: ${{ matrix.allow-failure }} |
| 34 | + strategy: |
| 35 | + matrix: |
| 36 | + include: |
| 37 | + - compiler: ghc-9.4.0.20220623 |
| 38 | + compilerKind: ghc |
| 39 | + compilerVersion: 9.4.0.20220623 |
| 40 | + setup-method: ghcup |
| 41 | + allow-failure: true |
| 42 | + - compiler: ghc-9.2.3 |
| 43 | + compilerKind: ghc |
| 44 | + compilerVersion: 9.2.3 |
| 45 | + setup-method: ghcup |
| 46 | + allow-failure: false |
| 47 | + - compiler: ghc-9.0.2 |
| 48 | + compilerKind: ghc |
| 49 | + compilerVersion: 9.0.2 |
| 50 | + setup-method: ghcup |
| 51 | + allow-failure: false |
| 52 | + - compiler: ghc-8.10.7 |
| 53 | + compilerKind: ghc |
| 54 | + compilerVersion: 8.10.7 |
| 55 | + setup-method: ghcup |
| 56 | + allow-failure: false |
| 57 | + - compiler: ghc-8.8.4 |
| 58 | + compilerKind: ghc |
| 59 | + compilerVersion: 8.8.4 |
| 60 | + setup-method: hvr-ppa |
| 61 | + allow-failure: false |
| 62 | + - compiler: ghc-8.6.5 |
| 63 | + compilerKind: ghc |
| 64 | + compilerVersion: 8.6.5 |
| 65 | + setup-method: hvr-ppa |
| 66 | + allow-failure: false |
| 67 | + - compiler: ghc-8.4.4 |
| 68 | + compilerKind: ghc |
| 69 | + compilerVersion: 8.4.4 |
| 70 | + setup-method: hvr-ppa |
| 71 | + allow-failure: false |
| 72 | + - compiler: ghc-8.2.2 |
| 73 | + compilerKind: ghc |
| 74 | + compilerVersion: 8.2.2 |
| 75 | + setup-method: hvr-ppa |
| 76 | + allow-failure: false |
| 77 | + - compiler: ghc-8.0.2 |
| 78 | + compilerKind: ghc |
| 79 | + compilerVersion: 8.0.2 |
| 80 | + setup-method: hvr-ppa |
| 81 | + allow-failure: false |
| 82 | + - compiler: ghc-7.10.3 |
| 83 | + compilerKind: ghc |
| 84 | + compilerVersion: 7.10.3 |
| 85 | + setup-method: hvr-ppa |
| 86 | + allow-failure: false |
| 87 | + - compiler: ghc-7.8.4 |
| 88 | + compilerKind: ghc |
| 89 | + compilerVersion: 7.8.4 |
| 90 | + setup-method: hvr-ppa |
| 91 | + allow-failure: false |
| 92 | + - compiler: ghc-7.6.3 |
| 93 | + compilerKind: ghc |
| 94 | + compilerVersion: 7.6.3 |
| 95 | + setup-method: hvr-ppa |
| 96 | + allow-failure: false |
| 97 | + - compiler: ghc-7.4.2 |
| 98 | + compilerKind: ghc |
| 99 | + compilerVersion: 7.4.2 |
| 100 | + setup-method: hvr-ppa |
| 101 | + allow-failure: false |
| 102 | + - compiler: ghc-7.2.2 |
| 103 | + compilerKind: ghc |
| 104 | + compilerVersion: 7.2.2 |
| 105 | + setup-method: hvr-ppa |
| 106 | + allow-failure: false |
| 107 | + - compiler: ghc-7.0.4 |
| 108 | + compilerKind: ghc |
| 109 | + compilerVersion: 7.0.4 |
| 110 | + setup-method: hvr-ppa |
| 111 | + allow-failure: false |
| 112 | + fail-fast: false |
| 113 | + steps: |
| 114 | + - name: apt |
| 115 | + run: | |
| 116 | + apt-get update |
| 117 | + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 |
| 118 | + if [ "${{ matrix.setup-method }}" = ghcup ]; then |
| 119 | + mkdir -p "$HOME/.ghcup/bin" |
| 120 | + curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" |
| 121 | + chmod a+x "$HOME/.ghcup/bin/ghcup" |
| 122 | + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; |
| 123 | + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) |
| 124 | + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) |
| 125 | + apt-get update |
| 126 | + apt-get install -y libxml2-dev |
| 127 | + else |
| 128 | + apt-add-repository -y 'ppa:hvr/ghc' |
| 129 | + apt-get update |
| 130 | + apt-get install -y "$HCNAME" libxml2-dev |
| 131 | + mkdir -p "$HOME/.ghcup/bin" |
| 132 | + curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" |
| 133 | + chmod a+x "$HOME/.ghcup/bin/ghcup" |
| 134 | + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) |
| 135 | + fi |
| 136 | + env: |
| 137 | + HCKIND: ${{ matrix.compilerKind }} |
| 138 | + HCNAME: ${{ matrix.compiler }} |
| 139 | + HCVER: ${{ matrix.compilerVersion }} |
| 140 | + - name: Set PATH and environment variables |
| 141 | + run: | |
| 142 | + echo "$HOME/.cabal/bin" >> $GITHUB_PATH |
| 143 | + echo "LANG=C.UTF-8" >> "$GITHUB_ENV" |
| 144 | + echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" |
| 145 | + echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" |
| 146 | + HCDIR=/opt/$HCKIND/$HCVER |
| 147 | + if [ "${{ matrix.setup-method }}" = ghcup ]; then |
| 148 | + HC=$HOME/.ghcup/bin/$HCKIND-$HCVER |
| 149 | + echo "HC=$HC" >> "$GITHUB_ENV" |
| 150 | + echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" |
| 151 | + echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" |
| 152 | + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" |
| 153 | + else |
| 154 | + HC=$HCDIR/bin/$HCKIND |
| 155 | + echo "HC=$HC" >> "$GITHUB_ENV" |
| 156 | + echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" |
| 157 | + echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" |
| 158 | + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" |
| 159 | + fi |
| 160 | +
|
| 161 | + HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') |
| 162 | + echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" |
| 163 | + echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" |
| 164 | + echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" |
| 165 | + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi |
| 166 | + echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" |
| 167 | + echo "GHCJSARITH=0" >> "$GITHUB_ENV" |
| 168 | + env: |
| 169 | + HCKIND: ${{ matrix.compilerKind }} |
| 170 | + HCNAME: ${{ matrix.compiler }} |
| 171 | + HCVER: ${{ matrix.compilerVersion }} |
| 172 | + - name: env |
| 173 | + run: | |
| 174 | + env |
| 175 | + - name: write cabal config |
| 176 | + run: | |
| 177 | + mkdir -p $CABAL_DIR |
| 178 | + cat >> $CABAL_CONFIG <<EOF |
| 179 | + remote-build-reporting: anonymous |
| 180 | + write-ghc-environment-files: never |
| 181 | + remote-repo-cache: $CABAL_DIR/packages |
| 182 | + logs-dir: $CABAL_DIR/logs |
| 183 | + world-file: $CABAL_DIR/world |
| 184 | + extra-prog-path: $CABAL_DIR/bin |
| 185 | + symlink-bindir: $CABAL_DIR/bin |
| 186 | + installdir: $CABAL_DIR/bin |
| 187 | + build-summary: $CABAL_DIR/logs/build.log |
| 188 | + store-dir: $CABAL_DIR/store |
| 189 | + install-dirs user |
| 190 | + prefix: $CABAL_DIR |
| 191 | + repository hackage.haskell.org |
| 192 | + url: http://hackage.haskell.org/ |
| 193 | + EOF |
| 194 | + if $HEADHACKAGE; then |
| 195 | + cat >> $CABAL_CONFIG <<EOF |
| 196 | + repository head.hackage.ghc.haskell.org |
| 197 | + url: https://ghc.gitlab.haskell.org/head.hackage/ |
| 198 | + secure: True |
| 199 | + root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d |
| 200 | + 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 |
| 201 | + f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 |
| 202 | + key-threshold: 3 |
| 203 | + active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override |
| 204 | + EOF |
| 205 | + fi |
| 206 | + cat >> $CABAL_CONFIG <<EOF |
| 207 | + program-default-options |
| 208 | + ghc-options: $GHCJOBS +RTS -M3G -RTS |
| 209 | + EOF |
| 210 | + cat $CABAL_CONFIG |
| 211 | + - name: versions |
| 212 | + run: | |
| 213 | + $HC --version || true |
| 214 | + $HC --print-project-git-commit-id || true |
| 215 | + $CABAL --version || true |
| 216 | + - name: update cabal index |
| 217 | + run: | |
| 218 | + $CABAL v2-update -v |
| 219 | + - name: install cabal-plan |
| 220 | + run: | |
| 221 | + mkdir -p $HOME/.cabal/bin |
| 222 | + 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 |
| 223 | + echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - |
| 224 | + xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan |
| 225 | + rm -f cabal-plan.xz |
| 226 | + chmod a+x $HOME/.cabal/bin/cabal-plan |
| 227 | + cabal-plan --version |
| 228 | + - name: checkout |
| 229 | + uses: actions/checkout@v2 |
| 230 | + with: |
| 231 | + path: source |
| 232 | + - name: initial cabal.project for sdist |
| 233 | + run: | |
| 234 | + touch cabal.project |
| 235 | + echo "packages: $GITHUB_WORKSPACE/source/./core" >> cabal.project |
| 236 | + echo "packages: $GITHUB_WORKSPACE/source/./hunit" >> cabal.project |
| 237 | + echo "packages: $GITHUB_WORKSPACE/source/./quickcheck2" >> cabal.project |
| 238 | + echo "packages: $GITHUB_WORKSPACE/source/./example" >> cabal.project |
| 239 | + cat cabal.project |
| 240 | + - name: sdist |
| 241 | + run: | |
| 242 | + mkdir -p sdist |
| 243 | + $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist |
| 244 | + - name: unpack |
| 245 | + run: | |
| 246 | + mkdir -p unpacked |
| 247 | + find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; |
| 248 | + - name: generate cabal.project |
| 249 | + run: | |
| 250 | + PKGDIR_test_framework="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/test-framework-[0-9.]*')" |
| 251 | + echo "PKGDIR_test_framework=${PKGDIR_test_framework}" >> "$GITHUB_ENV" |
| 252 | + PKGDIR_test_framework_hunit="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/test-framework-hunit-[0-9.]*')" |
| 253 | + echo "PKGDIR_test_framework_hunit=${PKGDIR_test_framework_hunit}" >> "$GITHUB_ENV" |
| 254 | + PKGDIR_test_framework_quickcheck2="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/test-framework-quickcheck2-[0-9.]*')" |
| 255 | + echo "PKGDIR_test_framework_quickcheck2=${PKGDIR_test_framework_quickcheck2}" >> "$GITHUB_ENV" |
| 256 | + PKGDIR_test_framework_example="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/test-framework-example-[0-9.]*')" |
| 257 | + echo "PKGDIR_test_framework_example=${PKGDIR_test_framework_example}" >> "$GITHUB_ENV" |
| 258 | + rm -f cabal.project cabal.project.local |
| 259 | + touch cabal.project |
| 260 | + touch cabal.project.local |
| 261 | + echo "packages: ${PKGDIR_test_framework}" >> cabal.project |
| 262 | + echo "packages: ${PKGDIR_test_framework_hunit}" >> cabal.project |
| 263 | + echo "packages: ${PKGDIR_test_framework_quickcheck2}" >> cabal.project |
| 264 | + echo "packages: ${PKGDIR_test_framework_example}" >> cabal.project |
| 265 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package test-framework" >> cabal.project ; fi |
| 266 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi |
| 267 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package test-framework-hunit" >> cabal.project ; fi |
| 268 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi |
| 269 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package test-framework-quickcheck2" >> cabal.project ; fi |
| 270 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi |
| 271 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package test-framework-example" >> cabal.project ; fi |
| 272 | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi |
| 273 | + cat >> cabal.project <<EOF |
| 274 | + package libxml |
| 275 | + extra-include-dirs: /usr/include/libxml2 |
| 276 | + EOF |
| 277 | + if $HEADHACKAGE; then |
| 278 | + echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project |
| 279 | + fi |
| 280 | + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(test-framework|test-framework-example|test-framework-hunit|test-framework-quickcheck2)$/; }' >> cabal.project.local |
| 281 | + cat cabal.project |
| 282 | + cat cabal.project.local |
| 283 | + - name: dump install plan |
| 284 | + run: | |
| 285 | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all |
| 286 | + cabal-plan |
| 287 | + - name: cache |
| 288 | + uses: actions/cache@v2 |
| 289 | + with: |
| 290 | + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} |
| 291 | + path: ~/.cabal/store |
| 292 | + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- |
| 293 | + - name: install dependencies |
| 294 | + run: | |
| 295 | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all |
| 296 | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all |
| 297 | + - name: build w/o tests |
| 298 | + run: | |
| 299 | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all |
| 300 | + - name: build |
| 301 | + run: | |
| 302 | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always |
| 303 | + - name: tests |
| 304 | + run: | |
| 305 | + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct |
| 306 | + - name: cabal check |
| 307 | + run: | |
| 308 | + cd ${PKGDIR_test_framework} || false |
| 309 | + ${CABAL} -vnormal check |
| 310 | + cd ${PKGDIR_test_framework_hunit} || false |
| 311 | + ${CABAL} -vnormal check |
| 312 | + cd ${PKGDIR_test_framework_quickcheck2} || false |
| 313 | + ${CABAL} -vnormal check |
| 314 | + cd ${PKGDIR_test_framework_example} || false |
| 315 | + ${CABAL} -vnormal check |
| 316 | + - name: haddock |
| 317 | + run: | |
| 318 | + $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all |
| 319 | + - name: unconstrained build |
| 320 | + run: | |
| 321 | + rm -f cabal.project.local |
| 322 | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all |
0 commit comments