|
1 | | -# This GitHub workflow config has been generated by a script via |
2 | | -# |
3 | | -# haskell-ci 'github' 'lambda-ski.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.14.1 |
12 | | -# |
13 | | -# REGENDATA ("0.14.1",["github","lambda-ski.cabal"]) |
14 | | -# |
15 | 1 | name: Haskell-CI |
16 | 2 | on: |
17 | 3 | - push |
18 | 4 | - pull_request |
19 | 5 | jobs: |
20 | | - linux: |
21 | | - name: Haskell-CI - Linux - ${{ matrix.compiler }} |
22 | | - runs-on: ubuntu-22.04 |
23 | | - timeout-minutes: |
24 | | - 60 |
25 | | - container: |
26 | | - image: buildpack-deps:bionic |
| 6 | + build: |
| 7 | + name: GHC ${{ matrix.ghc-version }} |
| 8 | + runs-on: ubuntu-latest |
| 9 | + timeout-minutes: 60 |
27 | 10 | continue-on-error: ${{ matrix.allow-failure }} |
28 | 11 | strategy: |
| 12 | + fail-fast: false |
29 | 13 | matrix: |
30 | 14 | include: |
31 | | - - compiler: ghc-9.2.8 |
32 | | - compilerKind: ghc |
33 | | - compilerVersion: 9.2.8 |
34 | | - setup-method: ghcup |
| 15 | + - ghc-version: '9.2.8' |
35 | 16 | allow-failure: false |
36 | | - - compiler: ghc-9.4.5 |
37 | | - compilerKind: ghc |
38 | | - compilerVersion: 9.4.5 |
39 | | - setup-method: ghcup |
40 | | - allow-failure: false |
41 | | - - compiler: ghc-9.6.2 |
42 | | - compilerKind: ghc |
43 | | - compilerVersion: 9.6.2 |
44 | | - setup-method: ghcup |
| 17 | + - ghc-version: '9.4.8' |
| 18 | + allow-failure: false |
| 19 | + - ghc-version: '9.6.6' |
| 20 | + allow-failure: false |
| 21 | + - ghc-version: '9.8.2' |
| 22 | + allow-failure: false |
| 23 | + - ghc-version: '9.8.4' |
45 | 24 | allow-failure: false |
46 | | - fail-fast: false |
47 | 25 | steps: |
48 | | - - name: apt |
49 | | - run: | |
50 | | - apt-get update |
51 | | - apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 |
52 | | - mkdir -p "$HOME/.ghcup/bin" |
53 | | - curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup" |
54 | | - chmod a+x "$HOME/.ghcup/bin/ghcup" |
55 | | - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" |
56 | | - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 |
57 | | - env: |
58 | | - HCKIND: ${{ matrix.compilerKind }} |
59 | | - HCNAME: ${{ matrix.compiler }} |
60 | | - HCVER: ${{ matrix.compilerVersion }} |
61 | | - - name: Set PATH and environment variables |
62 | | - run: | |
63 | | - echo "$HOME/.cabal/bin" >> $GITHUB_PATH |
64 | | - echo "LANG=C.UTF-8" >> "$GITHUB_ENV" |
65 | | - echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" |
66 | | - echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" |
67 | | - HCDIR=/opt/$HCKIND/$HCVER |
68 | | - HC=$HOME/.ghcup/bin/$HCKIND-$HCVER |
69 | | - echo "HC=$HC" >> "$GITHUB_ENV" |
70 | | - echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" |
71 | | - echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" |
72 | | - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" |
73 | | - HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') |
74 | | - echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" |
75 | | - echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" |
76 | | - echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" |
77 | | - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" |
78 | | - echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" |
79 | | - echo "GHCJSARITH=0" >> "$GITHUB_ENV" |
80 | | - env: |
81 | | - HCKIND: ${{ matrix.compilerKind }} |
82 | | - HCNAME: ${{ matrix.compiler }} |
83 | | - HCVER: ${{ matrix.compilerVersion }} |
84 | | - - name: env |
85 | | - run: | |
86 | | - env |
87 | | - - name: write cabal config |
88 | | - run: | |
89 | | - mkdir -p $CABAL_DIR |
90 | | - cat >> $CABAL_CONFIG <<EOF |
91 | | - remote-build-reporting: anonymous |
92 | | - write-ghc-environment-files: never |
93 | | - remote-repo-cache: $CABAL_DIR/packages |
94 | | - logs-dir: $CABAL_DIR/logs |
95 | | - world-file: $CABAL_DIR/world |
96 | | - extra-prog-path: $CABAL_DIR/bin |
97 | | - symlink-bindir: $CABAL_DIR/bin |
98 | | - installdir: $CABAL_DIR/bin |
99 | | - build-summary: $CABAL_DIR/logs/build.log |
100 | | - store-dir: $CABAL_DIR/store |
101 | | - install-dirs user |
102 | | - prefix: $CABAL_DIR |
103 | | - repository hackage.haskell.org |
104 | | - url: http://hackage.haskell.org/ |
105 | | - EOF |
106 | | - cat >> $CABAL_CONFIG <<EOF |
107 | | - program-default-options |
108 | | - ghc-options: $GHCJOBS +RTS -M3G -RTS |
109 | | - EOF |
110 | | - cat $CABAL_CONFIG |
111 | | - - name: versions |
112 | | - run: | |
113 | | - $HC --version || true |
114 | | - $HC --print-project-git-commit-id || true |
115 | | - $CABAL --version || true |
116 | | - - name: update cabal index |
117 | | - run: | |
118 | | - $CABAL v2-update -v |
119 | | - - name: install cabal-plan |
120 | | - run: | |
121 | | - mkdir -p $HOME/.cabal/bin |
122 | | - 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 |
123 | | - echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - |
124 | | - xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan |
125 | | - rm -f cabal-plan.xz |
126 | | - chmod a+x $HOME/.cabal/bin/cabal-plan |
127 | | - cabal-plan --version |
128 | | - - name: checkout |
129 | | - uses: actions/checkout@v2 |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - uses: haskell-actions/setup@v2 |
| 29 | + id: setup |
130 | 30 | with: |
131 | | - path: source |
132 | | - - name: initial cabal.project for sdist |
133 | | - run: | |
134 | | - touch cabal.project |
135 | | - echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project |
136 | | - cat cabal.project |
137 | | - - name: sdist |
138 | | - run: | |
139 | | - mkdir -p sdist |
140 | | - $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist |
141 | | - - name: unpack |
142 | | - run: | |
143 | | - mkdir -p unpacked |
144 | | - find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; |
145 | | - - name: generate cabal.project |
146 | | - run: | |
147 | | - PKGDIR_lambda_ski="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/lambda-ski-[0-9.]*')" |
148 | | - echo "PKGDIR_lambda_ski=${PKGDIR_lambda_ski}" >> "$GITHUB_ENV" |
149 | | - rm -f cabal.project cabal.project.local |
150 | | - touch cabal.project |
151 | | - touch cabal.project.local |
152 | | - echo "packages: ${PKGDIR_lambda_ski}" >> cabal.project |
153 | | - echo "package lambda-ski" >> cabal.project |
154 | | - echo " ghc-options: -Werror=missing-methods" >> cabal.project |
155 | | - cat >> cabal.project <<EOF |
156 | | - EOF |
157 | | - $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(lambda-ski)$/; }' >> cabal.project.local |
158 | | - cat cabal.project |
159 | | - cat cabal.project.local |
160 | | - - name: dump install plan |
| 31 | + ghc-version: ${{ matrix.ghc-version }} |
| 32 | + cabal-version: 'latest' |
| 33 | + |
| 34 | + - name: Configure the build |
161 | 35 | run: | |
162 | | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all |
163 | | - cabal-plan |
164 | | - - name: cache |
165 | | - uses: actions/cache@v2 |
| 36 | + cabal configure --enable-tests --enable-benchmarks --disable-documentation |
| 37 | + cabal build --dry-run |
| 38 | + # The dry-run writes dist-newstyle/cache/plan.json used for cache key. |
| 39 | + |
| 40 | + - name: Restore cached dependencies |
| 41 | + uses: actions/cache/restore@v4 |
| 42 | + id: cache |
166 | 43 | with: |
167 | | - key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} |
168 | | - path: ~/.cabal/store |
169 | | - restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- |
170 | | - - name: install dependencies |
171 | | - run: | |
172 | | - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all |
173 | | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all |
174 | | - - name: build w/o tests |
175 | | - run: | |
176 | | - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all |
177 | | - - name: build |
178 | | - run: | |
179 | | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always |
180 | | - - name: tests |
181 | | - run: | |
182 | | - $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct |
| 44 | + path: ${{ steps.setup.outputs.cabal-store }} |
| 45 | + key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}-${{ hashFiles('**/plan.json') }} |
| 46 | + restore-keys: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}- |
| 47 | + |
| 48 | + - name: Install dependencies |
| 49 | + run: cabal build all --only-dependencies |
| 50 | + |
| 51 | + - name: Save cached dependencies |
| 52 | + uses: actions/cache/save@v4 |
| 53 | + if: ${{ steps.cache.outputs.cache-hit != 'true' }} |
| 54 | + with: |
| 55 | + path: ${{ steps.setup.outputs.cabal-store }} |
| 56 | + key: ${{ steps.cache.outputs.cache-primary-key }} |
| 57 | + |
| 58 | + - name: Build |
| 59 | + run: cabal build all |
| 60 | + |
| 61 | + - name: Run tests |
| 62 | + run: cabal test all --test-show-details=direct |
183 | 63 |
|
0 commit comments