|
| 1 | +# This GitHub workflow config has been generated by a script via |
| 2 | +# |
| 3 | +# haskell-ci 'github' 't.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.18.1 |
| 12 | +# |
| 13 | +# REGENDATA ("0.18.1",["github","t.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-20.04 |
| 23 | + timeout-minutes: |
| 24 | + 60 |
| 25 | + container: |
| 26 | + image: buildpack-deps:22.04 |
| 27 | + continue-on-error: ${{ matrix.allow-failure }} |
| 28 | + strategy: |
| 29 | + matrix: |
| 30 | + include: |
| 31 | + - compiler: ghc-9.8.2 |
| 32 | + compilerKind: ghc |
| 33 | + compilerVersion: 9.8.2 |
| 34 | + setup-method: ghcup |
| 35 | + allow-failure: false |
| 36 | + - compiler: ghc-9.6.4 |
| 37 | + compilerKind: ghc |
| 38 | + compilerVersion: 9.6.4 |
| 39 | + setup-method: ghcup |
| 40 | + allow-failure: false |
| 41 | + fail-fast: false |
| 42 | + steps: |
| 43 | + - name: apt |
| 44 | + run: | |
| 45 | + apt-get update |
| 46 | + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 |
| 47 | + mkdir -p "$HOME/.ghcup/bin" |
| 48 | + curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" |
| 49 | + chmod a+x "$HOME/.ghcup/bin/ghcup" |
| 50 | + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) |
| 51 | + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) |
| 52 | + env: |
| 53 | + HCKIND: ${{ matrix.compilerKind }} |
| 54 | + HCNAME: ${{ matrix.compiler }} |
| 55 | + HCVER: ${{ matrix.compilerVersion }} |
| 56 | + - name: Set PATH and environment variables |
| 57 | + run: | |
| 58 | + echo "$HOME/.cabal/bin" >> $GITHUB_PATH |
| 59 | + echo "LANG=C.UTF-8" >> "$GITHUB_ENV" |
| 60 | + echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" |
| 61 | + echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" |
| 62 | + HCDIR=/opt/$HCKIND/$HCVER |
| 63 | + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") |
| 64 | + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') |
| 65 | + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') |
| 66 | + echo "HC=$HC" >> "$GITHUB_ENV" |
| 67 | + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" |
| 68 | + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" |
| 69 | + echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" |
| 70 | + HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') |
| 71 | + echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" |
| 72 | + echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" |
| 73 | + echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" |
| 74 | + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" |
| 75 | + echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" |
| 76 | + echo "GHCJSARITH=0" >> "$GITHUB_ENV" |
| 77 | + env: |
| 78 | + HCKIND: ${{ matrix.compilerKind }} |
| 79 | + HCNAME: ${{ matrix.compiler }} |
| 80 | + HCVER: ${{ matrix.compilerVersion }} |
| 81 | + - name: env |
| 82 | + run: | |
| 83 | + env |
| 84 | + - name: write cabal config |
| 85 | + run: | |
| 86 | + mkdir -p $CABAL_DIR |
| 87 | + cat >> $CABAL_CONFIG <<EOF |
| 88 | + remote-build-reporting: anonymous |
| 89 | + write-ghc-environment-files: never |
| 90 | + remote-repo-cache: $CABAL_DIR/packages |
| 91 | + logs-dir: $CABAL_DIR/logs |
| 92 | + world-file: $CABAL_DIR/world |
| 93 | + extra-prog-path: $CABAL_DIR/bin |
| 94 | + symlink-bindir: $CABAL_DIR/bin |
| 95 | + installdir: $CABAL_DIR/bin |
| 96 | + build-summary: $CABAL_DIR/logs/build.log |
| 97 | + store-dir: $CABAL_DIR/store |
| 98 | + install-dirs user |
| 99 | + prefix: $CABAL_DIR |
| 100 | + repository hackage.haskell.org |
| 101 | + url: http://hackage.haskell.org/ |
| 102 | + EOF |
| 103 | + cat >> $CABAL_CONFIG <<EOF |
| 104 | + program-default-options |
| 105 | + ghc-options: $GHCJOBS +RTS -M3G -RTS |
| 106 | + EOF |
| 107 | + cat $CABAL_CONFIG |
| 108 | + - name: versions |
| 109 | + run: | |
| 110 | + $HC --version || true |
| 111 | + $HC --print-project-git-commit-id || true |
| 112 | + $CABAL --version || true |
| 113 | + - name: update cabal index |
| 114 | + run: | |
| 115 | + $CABAL v2-update -v |
| 116 | + - name: install cabal-plan |
| 117 | + run: | |
| 118 | + mkdir -p $HOME/.cabal/bin |
| 119 | + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz |
| 120 | + echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - |
| 121 | + xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan |
| 122 | + rm -f cabal-plan.xz |
| 123 | + chmod a+x $HOME/.cabal/bin/cabal-plan |
| 124 | + cabal-plan --version |
| 125 | + - name: checkout |
| 126 | + uses: actions/checkout@v3 |
| 127 | + with: |
| 128 | + path: source |
| 129 | + - name: initial cabal.project for sdist |
| 130 | + run: | |
| 131 | + touch cabal.project |
| 132 | + echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project |
| 133 | + cat cabal.project |
| 134 | + - name: sdist |
| 135 | + run: | |
| 136 | + mkdir -p sdist |
| 137 | + $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist |
| 138 | + - name: unpack |
| 139 | + run: | |
| 140 | + mkdir -p unpacked |
| 141 | + find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; |
| 142 | + - name: generate cabal.project |
| 143 | + run: | |
| 144 | + PKGDIR_t="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/t-[0-9.]*')" |
| 145 | + echo "PKGDIR_t=${PKGDIR_t}" >> "$GITHUB_ENV" |
| 146 | + rm -f cabal.project cabal.project.local |
| 147 | + touch cabal.project |
| 148 | + touch cabal.project.local |
| 149 | + echo "packages: ${PKGDIR_t}" >> cabal.project |
| 150 | + echo "package t" >> cabal.project |
| 151 | + echo " ghc-options: -Werror=missing-methods" >> cabal.project |
| 152 | + cat >> cabal.project <<EOF |
| 153 | + EOF |
| 154 | + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(t)$/; }' >> cabal.project.local |
| 155 | + cat cabal.project |
| 156 | + cat cabal.project.local |
| 157 | + - name: dump install plan |
| 158 | + run: | |
| 159 | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all |
| 160 | + cabal-plan |
| 161 | + - name: restore cache |
| 162 | + uses: actions/cache/restore@v3 |
| 163 | + with: |
| 164 | + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} |
| 165 | + path: ~/.cabal/store |
| 166 | + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- |
| 167 | + - name: install dependencies |
| 168 | + run: | |
| 169 | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all |
| 170 | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all |
| 171 | + - name: build w/o tests |
| 172 | + run: | |
| 173 | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all |
| 174 | + - name: build |
| 175 | + run: | |
| 176 | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always |
| 177 | + - name: tests |
| 178 | + run: | |
| 179 | + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct |
| 180 | + # this will always fail, because we don't use upper bounds, so we need a little bit of `|| true` |
| 181 | + - name: cabal check |
| 182 | + run: | |
| 183 | + cd ${PKGDIR_t} || false |
| 184 | + ${CABAL} -vnormal check || true |
| 185 | + - name: haddock |
| 186 | + run: | |
| 187 | + $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all |
| 188 | + # - name: unconstrained build |
| 189 | + # run: | |
| 190 | + # rm -f cabal.project.local |
| 191 | + # $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all |
| 192 | + - name: save cache |
| 193 | + uses: actions/cache/save@v3 |
| 194 | + if: always() |
| 195 | + with: |
| 196 | + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} |
| 197 | + path: ~/.cabal/store |
0 commit comments