-
Notifications
You must be signed in to change notification settings - Fork 118
185 lines (160 loc) · 5.4 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
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
name: CI
# Trigger the workflow on push or pull request
on:
# workflow_dispatch:
pull_request:
# branches: [master]
types: [synchronize, opened, reopened]
push:
# branches: [main]
paths:
- '.github/workflows/ci.yml'
- '*.cabal'
- 'cabal.project'
- 'stack.yaml'
- 'src/**'
- 'test/**'
- 'cbits/**'
schedule:
# additionally run once per week (At 00:00 on Sunday) to maintain cache
- cron: '0 0 * * 0'
jobs:
cabal:
name: cabal | ${{ matrix.os }}-${{ matrix.arch }} ghc-${{ matrix.ghc }} ${{ matrix.mode }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
- 'macOS-latest'
- 'windows-latest'
arch:
- "x64"
- "ARM64"
ghc:
- 'latest'
- '9.6'
- '9.4'
- '9.2'
- '9.0'
- '8.10'
mode:
- 'debug'
- 'release'
exclude:
- os: 'windows-latest'
mode: 'debug'
- arch: "ARM64"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: actions/cache
path: .github/actions/cache-always
ref: v3
# Tweak `action.yml` of `actions/cache@v3` to remove the `post-if`
# condition, making it default to `post-if: always ()`.
- name: Set up actions/cache-always@v3
run: |
sed -i'~' -e '/ post-if: /d' .github/actions/cache-always/action.yml
- name: Set up Haskell
uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: latest
- name: Set up environment
run: |
if [ ${{ matrix.mode }} == 'release' ]; then
echo CABAL_FLAGS=--enable-tests --test-show-details=direct --flags=nofib >> $GITHUB_ENV
else
if [ ${{ matrix.os }} == 'ubuntu-latest' ]; then
sudo apt-get -y install pkg-config libcapstone-dev libfreetype-dev libglfw3-dev libgtk-3-dev libtbb-dev
elif [ ${{ matrix.os }} == 'macOS-latest' ]; then
brew install pkg-config capstone freetype glfw
fi
echo CABAL_FLAGS=--enable-tests --test-show-details=direct --flags=nofib --flags=debug --ghc-options=\"-optc=-DTRACY_TIMER_FALLBACK\" --ghc-options=\"-optcxx=-DTRACY_TIMER_FALLBACK\" >> $GITHUB_ENV
fi
shell: bash
- name: Configure
run: cabal configure $CABAL_FLAGS
shell: bash
- name: Freeze
run: |
cabal freeze
sed -i'~' -e '/^index-state:/d' cabal.project.freeze
- name: Run actions/cache-always@v3
uses: ./.github/actions/cache-always
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.ghc }}-${{ matrix.mode }}-cabal-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-${{ matrix.ghc }}-${{ matrix.mode }}-cabal-${{ hashFiles('cabal.project.freeze') }}
${{ runner.os }}-${{ matrix.arch }}-${{ matrix.ghc }}-${{ matrix.mode }}-cabal-
- name: Build dependencies
run: cabal build --only-dependencies
- name: Build
run: cabal build
- name: Haddock
# Behaviour of cabal haddock has changed for the worse: https://github.com/haskell/cabal/issues/8725
run: cabal haddock --disable-documentation
if: matrix.mode == 'release'
- name: Test doctest
run: cabal test doctest
if: matrix.os == 'ubuntu-latest' && matrix.mode == 'release'
- name: Test nofib
run: cabal test nofib-interpreter
if: matrix.os != 'windows-latest'
stack:
name: stack | ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
- 'macOS-latest'
- 'windows-latest'
arch:
- "x64"
- "ARM64"
exclude:
- arch: "ARM64"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: actions/cache
path: .github/actions/cache-always
ref: v3
# Tweak `action.yml` of `actions/cache@v3` to remove the `post-if`
# condition, making it default to `post-if: always ()`.
- name: Set up actions/cache-always@v3
run: |
sed -i'~' -e '/ post-if: /d' .github/actions/cache-always/action.yml
- name: Set up Haskell
uses: haskell/actions/setup@v2
id: setup-haskell
with:
enable-stack: true
stack-no-global: true
- name: Run actions/cache-always@v3
uses: ./.github/actions/cache-always
with:
path: |
${{ steps.setup-haskell.outputs.stack-root }}
.stack-work
key: ${{ runner.os }}-${{ matrix.arch }}-stack-${{ hashFiles('stack.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-stack-${{ hashFiles('stack.yaml') }}
${{ runner.os }}-${{ matrix.arch }}-stack-
- name: Setup
run: stack setup
- name: Build dependencies
run: stack build --only-dependencies
- name: Build
run: stack build
# vi: nospell