-
Notifications
You must be signed in to change notification settings - Fork 12
160 lines (130 loc) · 4.22 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Haskell CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-cabal:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
ghc: ['8.10.7']
cabal: ['3.6.2.0']
exclude:
# can't build zlib
- os: windows-latest
ghc: '8.10.7'
cabal: '3.6.2.0'
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/[email protected]
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: create ~/.local/bin
run: mkdir -p "$HOME/.local/bin"
shell: bash
- name: Add ~/.local/bin to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: Cache
uses: actions/cache@v1
env:
cache-name: cache-cabal
with:
path: ~/.cabal
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-build-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-build-
${{ runner.os }}-${{ matrix.ghc }}-
${{ runner.os }}-
- name: Update cabal index
run: cabal update
shell: bash
- name: Install shelltestrunner
run: cabal install --installdir="$HOME/.local/bin" --install-method=copy --overwrite-policy=always -f _regex-posix-clib shelltestrunner
shell: bash
- name: Install dependencies
run: cabal build --only-dependencies --enable-tests --enable-benchmarks
shell: bash
- name: Build
run: cabal build --enable-tests --enable-benchmarks all
shell: bash
- name: Install
run: cabal install --installdir="$HOME/.local/bin" --install-method=copy --overwrite-policy=always
shell: bash
- name: Run tests
run: cabal test all
shell: bash
- name: Build haddock
run: cabal haddock lib:stack2cabal
shell: bash
- name: Run shelltest tests
run: cabal exec --offline --verbose=0 sh -- -c 'shelltest shelltest.test'
shell: bash
- if: always()
uses: actions/upload-artifact@v2
with:
name: plan.json
path: ./dist-newstyle/cache/plan.json
build-stack:
name: Stack ${{ matrix.stack }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
stack: ['latest']
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/[email protected]
with:
enable-stack: true
stack-no-global: true
stack-version: ${{ matrix.stack }}
- name: Add ~/.local/bin to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: Cache
uses: actions/cache@v1
env:
cache-name: stack-cabal
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.stack }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/stack.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install shelltestrunner
run: stack --local-bin-path=$HOME/.local/bin install --flag regex-posix:_regex-posix-clib shelltestrunner
shell: bash
- name: Install dependencies
run: |
stack install --dependencies-only --flag zlib:bundled-c-zlib
shell: bash
- name: Build
run: stack build --flag zlib:bundled-c-zlib
shell: bash
- name: Install
run: stack install --flag zlib:bundled-c-zlib
shell: bash
- if: matrix.os == 'ubuntu-latest'
name: Install git
run: sudo apt-get install git
- if: matrix.os == 'macOS-latest'
name: Install git
run: brew install git
- if: matrix.os == 'windows-latest'
name: Install git
run: choco install git
- name: Run tests
run: stack test
shell: bash
- name: Run shelltest tests
run: stack exec sh -- -c 'shelltest shelltest.test'
shell: bash