-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (84 loc) · 2.54 KB
/
build.yaml
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
name: Build
on:
push:
schedule:
- cron: '0 8 * * *'
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ['9.10', '9.8', '9.6', '9.4']
cabal: ['3.12']
os: ['ubuntu-22.04', 'ubuntu-20.04', 'macOS-latest']
flags: [ '-with-time' ]
include:
- ghc: '9.8'
cabal: '3.12'
os: 'ubuntu-20.04'
flags: '+with-time'
- ghc: '9.4'
cabal: '3.12'
os: 'ubuntu-20.04'
flags: '+with-time'
steps:
# Setup
- name: Checkout repository
uses: actions/checkout@v4
- name: Install GHC and Cabal
id: setup
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cabal-update: true
- name: Configure project
run: |
cat > cabal.project.local <<EOF
package pact-time
documentation: True
benchmarks: True
tests: True
flags: ${{ matrix.flags }}
EOF
cabal build all --dry-run
cabal freeze
# Restore Packages from Caches
- uses: actions/cache@v3
name: cache cabal store
with:
path: |
~/.cabal/packages
~/.cabal/store
./dist-newstyle
key: ${{ matrix.os }}-${{ matrix.ghc }}
- name: Restore cached dependencies
uses: actions/cache/restore@v4
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') }}
restore-keys: ${{ env.key }}-
- name: Install dependencies
# If we had an exact cache hit, the dependencies will be up to date.
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: Save cached dependencies
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:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
# Build
- name: Build library
run: cabal build
# Tests
- name: Run Tests
run: cabal test