Skip to content

Commit 2ae5311

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

File tree

2 files changed

+224
-0
lines changed

2 files changed

+224
-0
lines changed

.github/workflows/haskell-ci.yml

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

http-proxy.cabal

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ 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 ==8.10.7
31+
|| ==9.6.7
32+
|| ==9.8.4
33+
|| ==9.10.2
34+
|| ==9.12.2
35+
36+
2937
source-repository head
3038
type: git
3139
location: https://github.com/erikd/http-proxy.git

0 commit comments

Comments
 (0)