-
-
Notifications
You must be signed in to change notification settings - Fork 6
75 lines (68 loc) · 2.26 KB
/
haskell.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
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
config-dir: 'ci-configs'
jobs:
enumerate:
name: Generate Build Matrix Dynamically
runs-on: ubuntu-latest
outputs:
configs: ${{ steps.enumerate.outputs.configs }}
steps:
- uses: actions/checkout@v3
- name: Enumerate Configs
id: enumerate
run: |
set -euxo pipefail
find "${{env.config-dir}}"/ -type f -name 'ghc-*.config' \
| sort -h | jq -ncR '[inputs | {ghc: match("ghc-(.+)\\.config$", .) | .captures[0].string | select(.), plan: .}]' | tee configs.json
echo "configs=$(cat configs.json)" >> "${GITHUB_OUTPUT}"
build:
name: Build
needs: [enumerate]
strategy:
fail-fast: false
matrix:
include: ${{fromJSON(needs.enumerate.outputs.configs)}}
runs-on: ubuntu-latest
env:
CABAL: cabal --project-file=${{matrix.plan}}
continue-on-error: false
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: false
- name: Cache ~/.cabal/store
uses: actions/cache@v2
env:
cache-name: cache-cabal-store
with:
path: ~/.cabal/store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '${{matrix.plan}}') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.ghc }}-
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Cache dist-newstyle
uses: actions/cache@v2
env:
cache-name: cache-dist-newstyle
with:
path: "dist-newstyle"
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '${{matrix.plan}}') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '${{matrix.plan}}') }}-
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.ghc }}-
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Configure and update
run: |
${CABAL} v2-configure
${CABAL} v2-update
- name: Build
run: |
${CABAL} v2-build