@@ -2,8 +2,8 @@ name: "Test"
2
2
on :
3
3
pull_request :
4
4
jobs :
5
- nix :
6
- name : ' Nix'
5
+ nix-build :
6
+ name : ' Nix / Build '
7
7
strategy :
8
8
matrix :
9
9
os : [ubuntu-latest, macos-latest]
@@ -29,33 +29,74 @@ jobs:
29
29
name : kore
30
30
signingKey : ' ${{ secrets.KORE_CACHIX_SIGNING_KEY }}'
31
31
32
- - name : Check materialization
33
- run : |
34
- ./nix/rematerialize.sh
35
- if [ ! $(git status --porcelain | wc -l) -eq 0 ]; then
36
- git diff
37
- exit 1
38
- fi
32
+ - name : Build
33
+ run : nix-build -A kore
39
34
40
- - name : Commit changes
41
- uses :
stefanzweifel/[email protected]
35
+ nix-shell :
36
+ name : ' Nix / Shell'
37
+ strategy :
38
+ matrix :
39
+ os : [ubuntu-latest, macos-latest]
40
+ runs-on : ${{ matrix.os }}
41
+ steps :
42
+ - name : Check out code
43
+
42
44
with :
43
- commit_message : ' Materialize Nix expressions'
44
- file_pattern : ' nix/'
45
+ # Check out pull request HEAD instead of merge commit.
46
+ ref : ${{ github.event.pull_request.head.sha }}
47
+ submodules : recursive
45
48
46
- - name : Build
47
- run : nix-build -A kore
49
+ - name : Install Nix
50
+ uses : cachix/install-nix-action@v12
51
+ with :
52
+ extra_nix_config : |
53
+ substituters = http://cache.nixos.org https://hydra.iohk.io
54
+ trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
48
55
49
- - name : Run unit tests
50
- run : nix-build -A project.kore.checks
56
+ - name : Install Cachix
57
+ uses : cachix/cachix-action@v8
58
+ with :
59
+ name : kore
60
+ signingKey : ' ${{ secrets.KORE_CACHIX_SIGNING_KEY }}'
51
61
52
62
- name : Check shell
53
63
run : nix-shell --run "echo OK"
54
64
65
+ nix-test :
66
+ name : ' Nix / Test'
67
+ needs : nix-build
68
+ strategy :
69
+ matrix :
70
+ os : [ubuntu-latest, macos-latest]
71
+ runs-on : ${{ matrix.os }}
72
+ steps :
73
+ - name : Check out code
74
+
75
+ with :
76
+ # Check out pull request HEAD instead of merge commit.
77
+ ref : ${{ github.event.pull_request.head.sha }}
78
+ submodules : recursive
79
+
80
+ - name : Install Nix
81
+ uses : cachix/install-nix-action@v12
82
+ with :
83
+ extra_nix_config : |
84
+ substituters = http://cache.nixos.org https://hydra.iohk.io
85
+ trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
86
+
87
+ - name : Install Cachix
88
+ uses : cachix/cachix-action@v8
89
+ with :
90
+ name : kore
91
+ signingKey : ' ${{ secrets.KORE_CACHIX_SIGNING_KEY }}'
92
+
93
+ - name : Run unit tests
94
+ run : nix-build -A project.kore.checks
95
+
55
96
nix-integration :
56
97
name : ' Nix / Integration'
57
98
runs-on : ubuntu-latest
58
- needs : nix
99
+ needs : nix-build
59
100
steps :
60
101
- name : Check out code
61
102
@@ -97,18 +138,20 @@ jobs:
97
138
ref : ${{ github.event.pull_request.head.sha }}
98
139
submodules : recursive
99
140
141
+ - name : Cache Cabal package database and store
142
+ uses : actions/cache@v2
143
+ with :
144
+ path : |
145
+ ~/.cabal/packages
146
+ ~/.cabal/store
147
+ key : cabal-1-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}
148
+
100
149
- uses : haskell/actions/setup@v1
101
150
id : setup-haskell-cabal
102
151
with :
103
152
ghc-version : ${{ env.ghc_version }}
104
153
cabal-version : " 3.2"
105
154
106
- - name : Cache Cabal store
107
- uses : actions/cache@v2
108
- with :
109
- path : ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
110
- key : ${{ runner.os }}-ghc-${{ env.ghc_version }}
111
-
112
155
- name : Build
113
156
run : cabal v2-build --enable-tests --enable-benchmarks all
114
157
@@ -132,28 +175,23 @@ jobs:
132
175
ref : ${{ github.event.pull_request.head.sha }}
133
176
submodules : recursive
134
177
178
+ - name : Cache Stack root
179
+ uses : actions/cache@v2
180
+ with :
181
+ path : ~/.stack
182
+ key : stack-1-${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }}
183
+
135
184
- uses : haskell/actions/setup@v1
136
185
id : setup-haskell-stack
137
186
with :
138
187
enable-stack : true
139
188
stack-no-global : true
140
189
stack-setup-ghc : true
141
190
142
- - name : Locate Stack root
143
- id : locate-stack-root
144
- run : |
145
- echo "::set-output name=stack-root::$(stack path --stack-root)"
146
-
147
- - name : Cache Stack root
148
- uses : actions/cache@v2
149
- with :
150
- path : ${{ steps.locate-stack-root.outputs.stack-root }}
151
- key : ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }}
152
-
153
191
- name : Build dependencies
154
192
run : |
155
- stack build --only-dependencies
156
- if [ ! $(git status --porcelain | wc -l) -eq 0 ]; then
193
+ stack build --test -- only-dependencies
194
+ if [ -n " $(git status --porcelain)" ]; then
157
195
git diff
158
196
exit 1
159
197
fi
@@ -176,37 +214,3 @@ jobs:
176
214
177
215
- name : Run hlint
178
216
run : curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s kore -j
179
-
180
- fourmolu :
181
- name : ' Style'
182
- runs-on : ubuntu-latest
183
- steps :
184
- - name : Check out code
185
-
186
- with :
187
- submodules : recursive
188
-
189
- - name : Install Nix
190
- uses : cachix/install-nix-action@v12
191
- with :
192
- extra_nix_config : |
193
- substituters = http://cache.nixos.org https://hydra.iohk.io
194
- trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
195
-
196
- - name : Install Cachix
197
- uses : cachix/cachix-action@v8
198
- with :
199
- name : kore
200
- signingKey : ' ${{ secrets.KORE_CACHIX_SIGNING_KEY }}'
201
- skipPush : true
202
-
203
- - name : Format
204
- run : |
205
- ./nix/fourmolu.sh
206
-
207
- - name : Check for changes
208
- run : |
209
- if [ ! $(git status --porcelain | wc -l) -eq 0 ]; then
210
- git diff
211
- exit 1
212
- fi
0 commit comments