-
-
Notifications
You must be signed in to change notification settings - Fork 77
110 lines (102 loc) · 2.95 KB
/
build-haskell.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build cabal project
on:
workflow_dispatch:
pull_request:
types:
- synchronize
- opened
- reopened
merge_group:
push:
branches:
- main
schedule:
# Run once per day (at UTC 18:00) to maintain cache:
- cron: 0 18 * * *
jobs:
build:
name: ${{ matrix.os }}-ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
allow-failure:
- false
os:
- ubuntu-latest
cabal:
# Cabal 3.12 does not work due to 'entropy' dependency.
- '3.10'
ghc:
- '8.0'
- '8.2'
- '8.4'
- '8.6'
- '8.8'
- '8.10'
- '9.2'
- '9.4'
- '9.6'
- '9.8'
- '9.10'
include:
- allow-failure: true
os: ubuntu-latest
cabal: '3.12'
ghc: '9.12'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Environment
uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Configure
run: |
cabal configure \
--enable-tests \
--enable-benchmarks \
--enable-documentation \
--test-show-details=direct \
--write-ghc-environment-files=always
cabal build all --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
# For a description of how the Caching works, see
# https://github.com/haskell-actions/setup?tab=readme-ov-file#model-cabal-workflow-with-caching
- name: Dependencies (Restore from cache)
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}
hash: ${{ hashFiles('**/plan.json') }}
with:
key: ${{ env.key }}-${{ env.hash }}
restore-keys: ${{ env.key }}-
path: ${{ steps.setup.outputs.cabal-store }}
- name: Dependencies (Install)
if: steps.cache.outputs.cache-hit != 'true'
run: cabal build all --only-dependencies
# Cache dependencies already here,
# so that we do not have to rebuild them should the subsequent steps fail.
- name: Dependencies (Save cache)
uses: actions/cache/save@v4
# If we had an exact cache hit,
# trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache.outputs.cache-primary-key }}
path: ${{ steps.setup.outputs.cabal-store }}
- name: Build
run: >
cabal build all
--enable-tests
--enable-benchmarks
- name: Test
run: >
cabal test all
- name: Benchmark
run: >
cabal bench all
|| true