Skip to content

Commit 0c0fbfe

Browse files
committed
Generate CI spec using haskell-ci program
1 parent 2e49135 commit 0c0fbfe

File tree

2 files changed

+218
-0
lines changed

2 files changed

+218
-0
lines changed

.github/workflows/haskell-ci.yml

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

http-proxy.cabal

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ description:
2626
a functions for exception reporting and request re-writing. Eventually, this
2727
capability will be expanded to allow optional logging, disk caching etc.
2828

29+
tested-with:
30+
GHC ==9.6.7
31+
|| ==9.8.4
32+
|| ==9.10.2
33+
|| ==9.12.2
34+
35+
2936
source-repository head
3037
type: git
3138
location: https://github.com/erikd/http-proxy.git

0 commit comments

Comments
 (0)