-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (74 loc) · 2.45 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
name: Build and Test
on:
push:
branches: [ master ]
env:
project-cabal-file: trie-simple.cabal
jobs:
generate-matrix:
name: "Generate matrix from cabal"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Extract the tested GHC versions
id: set-matrix
uses: kleidukos/[email protected]
with:
cabal-file: ${{ env.project-cabal-file }}
ubuntu-version: "latest"
version: 0.1.7.0
tests:
name: ${{ matrix.ghc }} on ${{ matrix.os }}
needs: generate-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Setup Haskell
uses: haskell-actions/[email protected]
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.10'
- name: Restore build and dependency cache
uses: actions/cache/restore@v4
id: restore-build-cache
with:
key: build-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles(env.project-cabal-file) }}
restore-keys: |
build-${{ matrix.os }}-${{ matrix.ghc }}-
path: |
~/.cabal/config
~/.cabal/packages
~/.cabal/store
dist-newstyle
- name: (debug) ls cache dir
run: |
echo "---- global cache ----"
ls ~/.cabal/store/ghc-${{ matrix.ghc }}/ || echo ":P)"
echo "---- local cache ----"
ls dist-newstyle/packagedb/ghc-${{ matrix.ghc }}/ || echo ":P)"
- name: Build dependencies
run: |
cabal update
cabal v2-build all --enable-tests --enable-benchmarks --only-dependencies
- name: Build
run: cabal v2-build all --enable-tests --enable-benchmarks
- name: Run test
run: cabal v2-test all
- name: (debug) ls cache dir
run: |
echo "---- global cache ----"
ls ~/.cabal/store/ghc-${{ matrix.ghc }}/ || echo ":P)"
echo "---- local cache ----"
ls dist-newstyle/packagedb/ghc-${{ matrix.ghc }}/ || echo ":P)"
- uses: actions/cache/save@v4
if: always()
with:
key: ${{ steps.restore-build-cache.outputs.cache-primary-key }}
path: |
~/.cabal/config
~/.cabal/packages
~/.cabal/store
dist-newstyle