-
Notifications
You must be signed in to change notification settings - Fork 2
141 lines (126 loc) · 4.05 KB
/
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
on: [push]
name: Haskell Builds
jobs:
build:
name: Haskell Build
runs-on: ubuntu-latest # or macOS-latest, or windows-latest
strategy:
fail-fast: false
matrix:
ghc-version:
- '9.6'
- '9.8'
- '9.10'
cabal-version: ['3.8.1.0']
steps:
# Checkout
- uses: actions/checkout@v3
# Setup
- name: Setup Haskell
uses: haskell-actions/setup@v2
id: setup
if: steps.tooling-cache.outputs.cache-hit != 'true'
with:
ghc-version: ${{ matrix.ghc-version }}
cabal-version: ${{ matrix.cabal-version }}
# Generate Plan
- name: Configure the Build
run: |
rm cabal.project.freeze
cabal configure --enable-tests --disable-optimization
cabal build --dry-run
# Restore cache
- name: Restore cached dependencies
uses: actions/cache/restore@v3
id: cache
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
# Build deps (for caching)
- name: Cabal build dependencies
run: cabal build all --only-dependencies
# Save dependency cache
- name: Save cache
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
# Cabal build
- name: Cabal Bulid
run: |
project="$(cat cabal.project | grep -v -- '-Werror')"
echo "$project" > cabal.project
cabal build all
# Cabal test
- name: Cabal Test
run: |
project="$(cat cabal.project | grep -v -- '-Werror')"
echo "$project" > cabal.project
cabal test all
build-lower-bounds:
name: Haskell Build (lower bounds)
runs-on: ubuntu-latest # or macOS-latest, or windows-latest
strategy:
fail-fast: false
matrix:
ghc-version: ['9.2.1']
cabal-version: ['3.8.1.0']
steps:
# Checkout
- uses: actions/checkout@v3
# Setup
- name: Setup Haskell
uses: haskell-actions/setup@v2
id: setup
if: steps.tooling-cache.outputs.cache-hit != 'true'
with:
ghc-version: ${{ matrix.ghc-version }}
cabal-version: ${{ matrix.cabal-version }}
# Generate Plan
- name: Configure the Build
run: |
(cat << EOF
packages: .
constraints:
aeson == 2.0.3.0,
base == 4.16.0.0,
bytestring == 0.11.1.0,
containers == 0.6.4.1,
hspec == 2.8.5,
scientific == 0.3.7.0,
text == 1.2.5.0,
time == 1.9.3,
vector == 0.12.3.1
EOF
) > cabal.project
rm cabal.project.freeze
cabal configure --enable-tests --disable-optimization
cabal build --dry-run
# Restore cache
- name: Restore cached dependencies
uses: actions/cache/restore@v3
id: cache
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
# Build deps (for caching)
- name: Cabal build dependencies
run: cabal build all --only-dependencies
# Save dependency cache
- name: Save cache
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
# Cabal build
- name: Cabal Bulid
run: cabal build all
# Cabal test
- name: Cabal Test
run: cabal test all