-
Notifications
You must be signed in to change notification settings - Fork 3
189 lines (175 loc) · 5.68 KB
/
test.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# Based on https://gist.github.com/mstksg/11f753d891cee5980326a8ea8c865233
name: Haskell Tests
on:
pull_request:
push:
branches:
- main
- "releases/*"
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
plan:
- {
build: stack,
arg: "--stack-yaml stack-lts-18.28.yaml",
ismain: false,
experimental: false,
ghc: "8107",
cachekey: "stack-810",
}
- {
build: stack,
arg: "--stack-yaml stack-lts-18.28-lowerbound.yaml",
ismain: false,
experimental: false,
ghc: "8107",
cachekey: "stack-810-l",
}
- {
build: stack,
arg: "--stack-yaml stack-lts-19.33.yaml",
ismain: false,
experimental: false,
ghc: "902",
cachekey: "stack-90",
}
- {
build: stack,
arg: "--stack-yaml stack-lts-20.26.yaml",
ismain: false,
experimental: false,
ghc: "928",
cachekey: "stack-92",
}
- {
build: stack,
arg: "--stack-yaml stack-lts-21.25.yaml",
ismain: false,
experimental: false,
ghc: "948",
cachekey: "stack-94",
}
- {
build: stack,
arg: "--stack-yaml stack-lts-22.33.yaml",
ismain: false,
experimental: false,
ghc: "966",
cachekey: "stack-96",
}
- {
build: stack,
arg: "",
ismain: true,
experimental: false,
ghc: "982",
cachekey: "stack-98",
}
- {
build: cabal,
arg: "",
ismain: false,
experimental: false,
ghc: "9101",
cachekey: "cabal-910",
}
include:
- os: macOS-latest
plan:
{
build: stack,
arg: "",
ismain: true,
experimental: false,
ghc: "982",
cachekey: "stack-98",
}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.plan.experimental }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: grisette-linux
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Cache key
id: cache_key
run: |
echo "stack=$(shasum stack.yaml | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "package=$(shasum package.yaml | awk '{print $1}')" >> $GITHUB_OUTPUT
- name: Use minimal flake
run: |
cp .github/workflows/flake-ci.nix flake.nix
case ${{ matrix.os }} in
macOS-latest)
sed -i '' "s/pkgs.haskell.packages.\"xxx\"/pkgs.haskell.packages.\"ghc${{ matrix.plan.ghc }}\"/" flake.nix
case ${{ matrix.plan.build }} in
stack)
sed -i '' "s/stableHPkgs.cabal-install//" flake.nix
;;
esac
;;
ubuntu-latest)
sed -i "s/pkgs.haskell.packages.\"xxx\"/pkgs.haskell.packages.\"ghc${{ matrix.plan.ghc }}\"/" flake.nix
case ${{ matrix.plan.build }} in
stack)
sed -i "s/stableHPkgs.cabal-install//" flake.nix
;;
esac
;;
esac
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: |
~/.stack
~/.cabal
dist-newstyle
key: stack-${{ matrix.os }}-${{ matrix.plan.cachekey }}-${{ steps.cache_key.outputs.package }}
restore-keys: |
stack-${{ matrix.os }}-${{ matrix.plan.cachekey }}
stack-${{ matrix.os }}
- name: Build & Test
id: test
run: |
set -ex
case "$BUILD" in
stack)
nix develop --allow-dirty --no-warn-dirty -c stack --no-terminal $ARGS test --fast --flag grisette:-optimize --bench --no-run-benchmarks --coverage --haddock --no-haddock-deps --test-arguments "--jxml=test-report.xml"
;;
cabal)
nix develop --allow-dirty --no-warn-dirty -c cabal update
nix develop --allow-dirty --no-warn-dirty -c cabal run --enable-tests --minimize-conflict-set --disable-optimization --flags=-optimize spec $ARGS -- --jxml=test-report.xml
;;
esac
set +ex
env:
ARGS: ${{ matrix.plan.arg }}
BUILD: ${{ matrix.plan.build }}
- uses: phoenix-actions/test-reporting@v8
with:
name: Tests-${{ matrix.os }}-${{ matrix.plan.build }}-${{ matrix.plan.ghc }}
path: "**/test-report.xml"
reporter: java-junit
if: matrix.os == 'ubuntu-latest' && (success() || failure ())
- name: Generate coverage report
uses: 8c6794b6/hpc-codecov-action@v2
with:
target: stack:all
if: matrix.os == 'ubuntu-latest' && matrix.plan.ismain
- name: Send coverage report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: matrix.os == 'ubuntu-latest' && matrix.plan.ismain