-
Notifications
You must be signed in to change notification settings - Fork 20
147 lines (125 loc) · 4.28 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
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
name: CI
on:
# Build every pull request, to check for regressions.
pull_request:
types: [opened, synchronize]
# Build when a PR is merged, to update the README's CI badge.
push:
branches: [main]
# Build once a month, to detect missing upper bounds.
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
stack:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Check that the build passes with the recommended snapshot.
- name: stable
stack_yaml: "stack.yaml"
os: ubuntu-latest
# Check that the lower bounds are still correct by building with the
# lowest-supported version of all our dependencies.
- name: oldest
stack_yaml: "oldest-supported-lts.yaml"
os: ubuntu-latest
steps:
- uses: actions/checkout@v2
# see https://github.com/actions/cache/issues/403
- name: Work around actions/cache bug
if: matrix.os == 'macos-latest'
run: |
brew update && brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- uses: actions/cache@v2
name: Cache Stack Artifacts
with:
path: |
~/.stack
~/.local/bin
.stack-work
key: ${{ runner.os }}-stack-${{ hashFiles(matrix.stack_yaml) }}-6
- uses: haskell-actions/setup@v2
id: setup-haskell-stack
name: Setup Stack
with:
enable-stack: true
stack-setup-ghc: true
stack-no-global: true
# For some reason, installing happy from lts-9.0 fails unless some other
# version of happy is already in the PATH. So let's install a version of
# happy from an lts which does not have this problem.
- name: Install happy
if: matrix.stack_yaml == 'oldest-supported-lts.yaml'
run: |
stack --stack-yaml=stack.yaml install happy
- name: Build with happy hack
if: matrix.stack_yaml == 'oldest-supported-lts.yaml'
run: |
PATH="$HOME/.local/bin:$PATH" stack --stack-yaml=${{ matrix.stack_yaml }} install --test --bench --no-run-tests --no-run-benchmarks
- name: Build
if: matrix.stack_yaml == 'stack.yaml'
run: |
stack --stack-yaml=${{ matrix.stack_yaml }} install --test --bench --no-run-tests --no-run-benchmarks
- name: Test
run: |
stack --stack-yaml=${{ matrix.stack_yaml }} test
- name: Run installed exe
run: |
stack run '2+2'
~/.local/bin/hawk '2+2'
cabal:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Check that our upper bounds are correct by building with the latest
# version of everything. We use cabal because it uses the latest
# versions of our dependencies allowed by our upper bounds.
#
# TODO: revert to "ghc: latest" once the latest version of ghc is
# supported, so we can detect when an even-more-recent version of ghc
# is released and breaks hawk.
- name: newest
ghc: 8.10.4
os: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
# This freeze file is regenerated on every build, so we will always test
# with the most recent version of our dependencies allowed by our upper
# bounds.
- name: Freeze
run: |
cabal v2-configure --enable-tests --enable-benchmarks --test-show-details=direct
cabal freeze
# Only reuse the cached copy of our dependencies if our freeze file matches
# the cache's copy.
- uses: actions/cache@v2
name: Cache Cabal Artifacts
with:
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-cabal-v2-${{ hashFiles('cabal.project.freeze') }}
- name: Build
run: |
cabal v2-build --enable-tests
- name: Test
run: |
rm -rf dist-newstyle/sdist sdist
cabal sdist
cp -r dist-newstyle/sdist .
cd sdist
tar xzvf *.tar.gz
rm -rf *.tar.gz
cd *
cabal test