Debian Codegraph @

.github/workflows/haskell-ci.yml

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