Skip to content

Commit 6cc2134

Browse files
Update the CI file to sync with latest packcheck
Also add new CIs.
1 parent 8babfa4 commit 6cc2134

1 file changed

Lines changed: 184 additions & 118 deletions

File tree

.github/workflows/build.yml

Lines changed: 184 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,170 +1,192 @@
1-
# packcheck-0.7.0
2-
# You can use any of the options supported by packcheck as environment
3-
# variables here. See https://github.com/composewell/packcheck for all
4-
# options and their explanation.
5-
1+
# packcheck-0.7.1
62
name: packcheck
73

8-
#-----------------------------------------------------------------------------
9-
# Events on which the build should be triggered
10-
#-----------------------------------------------------------------------------
11-
124
on:
5+
workflow_dispatch:
6+
pull_request:
137
push:
148
branches:
159
- master
16-
pull_request:
17-
18-
19-
#-----------------------------------------------------------------------------
20-
# Build matrix
21-
#-----------------------------------------------------------------------------
2210

2311
jobs:
2412
build:
25-
name: ${{ matrix.name }}
13+
name: >-
14+
${{ matrix.runner }}
15+
${{ matrix.command }}
16+
${{ matrix.ghc_version }}
17+
${{ matrix.name }}
2618
env:
27-
# ------------------------------------------------------------------------
28-
# Common options
29-
# ------------------------------------------------------------------------
30-
# GHC_OPTIONS: "-Werror"
31-
GHCUP_VERSION: 0.1.20.0
32-
DOCSPEC_URL: https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz
33-
DOCSPEC_OPTIONS: "--timeout 60"
3419
CABAL_REINIT_CONFIG: y
3520
LC_ALL: C.UTF-8
36-
37-
STACK_UPGRADE: "y"
38-
39-
CABAL_CHECK_RELAX: y
40-
CABAL_HACKAGE_MIRROR: hackage.haskell.org:http://hackage.fpcomplete.com
41-
21+
GHCUP_VERSION: 0.1.50.2
22+
GHCVER: ${{ matrix.ghc_version }}
4223
PACKCHECK: "./packcheck.sh"
4324
PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck"
44-
PACKCHECK_GITHUB_COMMIT: "7c4e1ab7a59b5ed6e92cfd0da67460a6116be4ac"
45-
46-
BUILD: ${{ matrix.build }}
47-
GHCVER: ${{ matrix.ghc_version }}
48-
#RESOLVER: ${{ matrix.resolver }}
49-
CABAL_BUILD_OPTIONS: >-
50-
-f drinkery
51-
-f conduit
52-
-f pipes
53-
-f machines
54-
-f streaming
55-
${{ matrix.cabal_build_options }}
56-
CABAL_PROJECT: ${{ matrix.cabal_project }}
57-
DISABLE_DOCS: ${{ matrix.disable_docs }}
58-
#DISABLE_SDIST_BUILD: ${{ matrix.disable_sdist_build }}
59-
#DISABLE_SDIST_BUILD: "y"
60-
HLINT_VERSION: 3.6.1
61-
HLINT_OPTIONS: ${{ matrix.hlint_options }}
62-
HLINT_TARGETS: ${{ matrix.hlint_targets }}
25+
PACKCHECK_GITHUB_COMMIT: "7c52b65e2eced274d819d717987a564d9def40dd"
26+
PACKCHECK_COMMAND: ${{ matrix.command }} ${{ matrix.pack_options }}
27+
SUBDIR: ${{ matrix.subdir }}
6328

6429
runs-on: ${{ matrix.runner }}
6530
strategy:
6631
fail-fast: false
6732
matrix:
6833
include:
69-
- name: 9.10.1-Werror
70-
ghc_version: 9.10.1
71-
build: cabal
34+
35+
#- name: ci
36+
# runner: ubuntu-latest
37+
# command: cabal
38+
# ghc_version: 9.14.1
39+
# pack_options: >-
40+
# CABAL_PROJECT=cabal.project.user
41+
# CABAL_BUILD_OPTIONS="-f drinkery -f conduit -f pipes -f machines -f streaming"
42+
43+
- name: bench-runner
7244
runner: ubuntu-latest
73-
cabal-version: 3.10.2.0
74-
cabal_project: cabal.project.Werror
45+
command: cabal
46+
ghc_version: 9.12.1
47+
subdir: bench-runner
48+
pack_options: >-
49+
CABAL_PROJECT=cabal.project.user
7550
76-
- name: 9.8.1-Werror
77-
ghc_version: 9.8.1
78-
build: cabal
51+
- name: ci
7952
runner: ubuntu-latest
80-
cabal-version: 3.10.2.0
81-
cabal_project: cabal.project.Werror
53+
command: cabal
54+
ghc_version: 9.12.1
55+
pack_options: >-
56+
CABAL_PROJECT=cabal.project.user
57+
CABAL_BUILD_OPTIONS="-f drinkery -f conduit -f pipes -f machines -f streaming"
8258
83-
- name: hlint
84-
build: hlint
85-
hlint_options: "lint"
86-
hlint_targets: "lib Benchmarks"
59+
- name: Werror
8760
runner: ubuntu-latest
88-
cabal-version: 3.2
89-
cabal_project: cabal.project.user
61+
command: cabal
62+
ghc_version: 9.10.3
63+
pack_options: >-
64+
CABAL_PROJECT=cabal.project.Werror
65+
CABAL_BUILD_OPTIONS="-f drinkery -f conduit -f pipes -f machines -f streaming"
66+
67+
- name: ci
68+
runner: ubuntu-latest
69+
command: cabal
70+
ghc_version: 9.8.1
71+
pack_options: >-
72+
CABAL_PROJECT=cabal.project.user
73+
CABAL_BUILD_OPTIONS="-f drinkery -f conduit -f pipes -f machines -f streaming"
9074
91-
- name: 9.6.3-macos
75+
- name: ci
9276
runner: macos-latest
77+
command: cabal
9378
ghc_version: 9.6.3
94-
build: cabal
95-
cabal-version: 3.10.1.0
96-
cabal_project: cabal.project.user
79+
pack_options: >-
80+
CABAL_PROJECT=cabal.project.user
81+
CABAL_BUILD_OPTIONS="-f drinkery -f conduit -f pipes -f machines -f streaming"
9782
98-
- name: 9.4.4-no-fusion-plugin
83+
- name: no-fusion-plugin
9984
runner: ubuntu-latest
85+
command: cabal
10086
ghc_version: 9.4.4
101-
build: cabal
102-
cabal-version: 3.8.1.0
103-
cabal_project: cabal.project.user
104-
cabal_build_options: -f no-fusion-plugin
87+
pack_options: >-
88+
CABAL_PROJECT=cabal.project.user
89+
CABAL_BUILD_OPTIONS="-f drinkery -f conduit -f pipes -f machines -f streaming -f no-fusion-plugin"
10590
106-
- name: 9.4.4
91+
- name: ci
10792
runner: ubuntu-latest
108-
ghc_version: 9.4.4
109-
build: cabal
110-
cabal-version: 3.8.1.0
111-
cabal_project: cabal.project.user
112-
113-
- name: 9.2.7
114-
runner: ubuntu-latest
115-
ghc_version: 9.2.7
116-
build: cabal
117-
cabal-version: 3.6
118-
cabal_project: cabal.project.user
119-
120-
- name: 8.10.7
93+
command: cabal
94+
ghc_version: 9.2.8
95+
pack_options: >-
96+
CABAL_PROJECT=cabal.project.user
97+
CABAL_BUILD_OPTIONS="-f drinkery -f conduit -f pipes -f machines -f streaming"
98+
99+
# --- Legacy GHC Series (Docs Disabled) ---
100+
- name: ci
121101
runner: ubuntu-latest
102+
command: cabal
122103
ghc_version: 8.10.7
123-
build: cabal
124-
cabal-version: 3.2
125-
cabal_project: cabal.project.user
126-
disable_docs: y
127-
128-
- name: 8.8.4
129-
runner: ubuntu-latest
130-
ghc_version: 8.8.4
131-
build: cabal
132-
cabal-version: 3.2
133-
cabal_project: cabal.project.user
134-
disable_docs: y
104+
pack_options: >-
105+
CABAL_PROJECT=cabal.project.user
106+
DISABLE_DOCS=y
107+
CABAL_BUILD_OPTIONS="-f drinkery -f conduit -f pipes -f machines -f streaming"
135108
136-
- name: 8.6.5
109+
# --- Tooling Jobs ---
110+
- name: ci
137111
runner: ubuntu-latest
138-
ghc_version: 8.6.5
139-
build: cabal
140-
cabal-version: 3.2
141-
cabal_project: cabal.project.user
142-
disable_docs: y
112+
command: hlint
113+
pack_options: >-
114+
HLINT_VERSION=3.6.1
115+
HLINT_OPTIONS="lint"
116+
HLINT_TARGETS="lib Benchmarks"
143117
118+
#-----------------------------------------------------------------------------
119+
# Usually you do need to change anything below, this is generic code for
120+
# caching and running packcheck on Linux/Mac/Windows.
121+
#-----------------------------------------------------------------------------
144122
steps:
145-
- uses: actions/checkout@v2
123+
- uses: actions/checkout@v4
146124

147-
- uses: actions/cache@v4
148-
name: Restore cache
125+
# This should happen before cache restore.
126+
- name: Remove ~/.ghcup symlink (non-Windows)
127+
if: runner.os != 'Windows'
128+
run: |
129+
rm -f ~/.ghcup
130+
131+
- name: Cache hackage package index (non-Windows)
132+
uses: actions/cache@v4
133+
if: runner.os != 'Windows'
134+
with:
135+
path: |
136+
~/.cache/cabal/packages
137+
# Bump the key version to clear the cache
138+
key: cache-cabal-packages
139+
140+
# See the "cabal path" output in the CI logs to tweak the cache locations
141+
# ghc is big but cheap to install, if cache size is a concern we can avoid
142+
# caching it.
143+
- name: Cache ghcup and ghc (non-Windows)
144+
uses: actions/cache@v4
145+
if: runner.os != 'Windows'
146+
with:
147+
path: |
148+
~/.ghcup
149+
key: ${{ matrix.runner }}-${{ matrix.ghc_version }}.${{ matrix.ghc_salt}}
150+
151+
# XXX If we want to invalidate the cache on resolver change we
152+
# should use a separate cache for stack as it should be keyed on
153+
# resolver as well. But that requires resolver as a matrix element
154+
# and then copied to pack_options from there, needs some work. It
155+
# should be fine as resolver minor version change can only increase
156+
# the cache size.
157+
- name: Cache build dependencies (non-Windows)
158+
uses: actions/cache@v4
159+
if: runner.os != 'Windows'
149160
with:
161+
# cabal: ~/.local/bin, ~/.local/state/cabal
162+
# ~/.cache/cabal/packages can be cached, but will increase the
163+
# cache size. But can save the "cabal update" time.
150164
path: |
151-
~/.local
152-
~/.cabal
165+
~/.local/bin
166+
~/.local/state/cabal
153167
~/.stack
154-
.stack-work
155-
key: ${{ runner.os }}-${{ matrix.name }}
168+
# Bump the key version to clear the cache
169+
key: ${{ matrix.runner }}-${{ matrix.command }}-${{ matrix.ghc_version }}-${{ matrix.name }}-v1
170+
171+
- name: Cache common directories (Windows)
172+
uses: actions/cache@v4
173+
if: runner.os == 'Windows'
174+
with:
175+
path: |
176+
${{ env.APPDATA }}/local
177+
C:/ghcup
178+
C:/cabal
179+
key: ${{ matrix.runner }}-${{ matrix.command }}-${{ matrix.ghc_version }}-${{ matrix.name }}-v1
156180

157181
- name: Download packcheck
182+
# on windows-latest GitHub Actions defaults to PowerShell
183+
shell: bash
158184
run: |
159-
# If a custom stack-yaml is specified, replace the default with that
160-
#if test -e "$STACK_YAML"; then rm -f stack.yaml && ln -sv $STACK_YAML stack.yaml; else true; fi
161-
#unset STACK_YAML
162-
163185
if test ! -e "$PACKCHECK"
164186
then
165187
if test -z "$PACKCHECK_GITHUB_COMMIT"
166188
then
167-
die "PACKCHECK_GITHUB_COMMIT is not specified."
189+
die "PACKCHECK_GITHUB_COMMIT env var is not specified."
168190
fi
169191
PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh
170192
curl --fail -sL -o "$PACKCHECK" $PACKCHECK_URL || exit 1
@@ -175,5 +197,49 @@ jobs:
175197
fi
176198
177199
- name: Run packcheck
200+
# on windows-latest GitHub Actions defaults to PowerShell
201+
shell: bash
178202
run: |
179-
bash -c "$PACKCHECK $BUILD"
203+
if test -n "$SUBDIR"
204+
then
205+
mv "$PACKCHECK" "$SUBDIR/packcheck.sh"
206+
# This is required otherwise dist-newstyle will be created in
207+
# the top level directory as it is considered the working dir.
208+
rm cabal.project
209+
cd "$SUBDIR"
210+
fi
211+
# Commands like mount, sysctl for info require sbin
212+
PATH_VAR=/bin:/usr/bin:/sbin:/usr/sbin
213+
case "$(uname)" in
214+
Linux)
215+
# On Linux it defaults to /usr/local, during cache restore
216+
# tar is unable to change permissions and restore fails.
217+
export GHCUP_INSTALL_BASE_PREFIX=$HOME
218+
;;
219+
CYGWIN*|MINGW*|MSYS*)
220+
PATH_VAR="$PATH_VAR:/c/Program Files/7-Zip:/mingw64/bin"
221+
;;
222+
esac
223+
# Use "bash -c" instead of invoking directly to preserve quoted
224+
# arguments in PACKCHECK_COMMAND e.g. DOCSPEC_OPTIONS="--timeout 60".
225+
# Direct invocation would word-split on spaces inside quoted values.
226+
echo "$PACKCHECK $PACKCHECK_COMMAND PATH=\"$PATH_VAR\""
227+
bash -c "$PACKCHECK $PACKCHECK_COMMAND PATH=\"$PATH_VAR\""
228+
229+
- name: Check cache locations
230+
if: runner.os != 'Windows'
231+
run: |
232+
# We want to see if it is a symlink; e.g. on github ~/.ghcup is a
233+
# pre-existing symlink to /usr/local.
234+
list="$HOME/.local/bin $HOME/.local/state/cabal $HOME/.ghcup $HOME/.stack"
235+
for dir in $list; do
236+
# macOS does not have --no-dereference option
237+
if [ -L "$dir" ]; then
238+
echo "$dir is a symlink -> $(readlink $dir)"
239+
else
240+
du -sh "$dir" 2>/dev/null || echo "$dir missing"
241+
fi
242+
done
243+
echo
244+
#ls -ld $list 2>/dev/null || true
245+
ls -al $list 2>/dev/null || true

0 commit comments

Comments
 (0)