-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (85 loc) · 2.96 KB
/
ci.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
name: CI
on:
push:
branches:
- master
pull_request:
types:
- opened
- synchronize
jobs:
build-test-ubuntu-stack:
runs-on: ubuntu-latest
name: Ubuntu / Stack
steps:
- uses: actions/checkout@v2
# relative paths are relative to the project directory
- name: Cache Stack build artifacts (user + project)
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
# best effort for cache: tie it to Stack resolver and package config
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml.lock', 'package.yaml') }}
restore-keys: |
${{ runner.os }}-stack
- name: Install project dependencies
run: stack --no-terminal test --only-dependencies
- name: Build and run tests
run: stack --no-terminal haddock --test --no-haddock-deps
build-test-ubuntu-cabal:
runs-on: ubuntu-latest
name: Ubuntu / GHC ${{ matrix.ghc }}, Cabal ${{ matrix.cabal }}
strategy:
fail-fast: false # don't stop if one job (= GHC version) fails
matrix:
cabal: ["3.4"] # latest as of 2021-06-16
ghc:
- "8.6.5"
- "9.2.4"
- "9.4.2"
env:
# note that all flags must be passed to every command even when
# irrelevant, else Cabal will trigger arbitrary rebuilds
CABAL_FLAGS: --enable-tests --enable-benchmarks --test-show-details=streaming
steps:
# TODO: GHC decides to recompile based on timestamp, so cache isn't used
# Preferably GHC would work via hashes instead. Stack had this feature
# merged in Aug 2020.
# Upstream GHC issue: https://gitlab.haskell.org/ghc/ghc/-/issues/16495
# My issue on haskell/actions: https://github.com/haskell/actions/issues/41
# This also requires us to do a deep fetch, else we don't get the Git commit
# history we need to rewrite mod times.
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set all tracked file modification times to the time of their last commit
run: |
rev=HEAD
for f in $(git ls-tree -r -t --full-name --name-only "$rev") ; do
touch -d $(git log --pretty=format:%cI -1 "$rev" -- "$f") "$f";
done
- name: Setup Haskell build environment
id: setup-haskell-build-env
uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Freeze Cabal plan
run: cabal freeze
- name: Cache Cabal build artifacts
uses: actions/cache@v2
with:
path: |
${{ steps.setup-haskell-build-env.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-cabal-${{ matrix.ghc }}
- name: Build
run: cabal build
- name: Test
run: cabal test --test-show-details=streaming
env:
HSPEC_OPTIONS: --color