-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
58 lines (48 loc) · 1.75 KB
/
benchmark.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
name: benchmarks
on: workflow_dispatch
permissions:
contents: read
jobs:
benchmark:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
versions:
- ghc: '8.10.7'
cabal: '3.2'
- ghc: '9.2.2'
cabal: '3.6'
steps:
- uses: actions/checkout@v4
- name: Install cabal/ghc
run: |
ghcup install ghc --set ${{ matrix.versions.ghc }}
ghcup install cabal ${{ matrix.versions.cabal }}
# declare/restore cached things
- name: Cache cabal global package db
id: cabal-global
uses: actions/cache@v4
with:
path: |
~/.cabal
key: benchmark-${{ runner.os }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-global-${{ secrets.CACHE_VERSION }}
- name: Cache cabal work
id: cabal-local
uses: actions/cache@v4
with:
path: |
dist-newstyle
key: benchmark-${{ runner.os }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-local-${{ secrets.CACHE_VERSION }}
- name: Install dependencies
run: |
v2=$([ "${{ matrix.versions.cabal }}" = "2.2" ] && printf 'new' || printf 'v2')
cabal $v2-update
cabal $v2-build --dependencies-only --enable-optimization=1 --enable-benchmarks --disable-tests
- name: Build and test
run: |
v2=$([ "${{ matrix.versions.cabal }}" = "2.2" ] && printf 'new' || printf 'v2')
cabal $v2-build --enable-optimization=1 --enable-benchmarks --disable-tests 2>&1 | tee build.log
# fail if warnings in local build
! grep -q ": *[Ww]arning:" build.log || exit 1
cabal $v2-bench --enable-optimization=1 --benchmark-options='--timeout=6 +RTS -T -RTS'