-
Notifications
You must be signed in to change notification settings - Fork 11
264 lines (237 loc) · 9.88 KB
/
build.yaml
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
on:
push:
branches:
- master
tags:
- '*'
pull_request:
name: build
jobs:
build:
name: build
runs-on: ${{ matrix.os }}
env:
STACK_YAML: ${{ matrix.stack_yaml }}
strategy:
fail-fast: false
matrix:
include:
- ghc: '9.8.2'
os: ubuntu-latest
stack_yaml: 'stack-ghc-9.8.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018'
platform: linux-x86_64
coveralls: false
- ghc: '9.6.6'
os: ubuntu-latest
stack_yaml: 'stack-ghc-9.6.yaml'
stack_args: '--haddock --no-haddock-deps'
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018'
platform: linux-x86_64
coveralls: false
release: true
- ghc: '9.6.6'
os: macos-latest
stack_yaml: 'stack-ghc-9.6.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018'
platform: macos-aarch64
coveralls: false
release: true
- ghc: '9.6.6'
os: macos-latest
stack_yaml: 'stack-ghc-9.6.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms --flag toysolver:optparse-applicative-018'
platform: macos-x86_64
coveralls: false
release: true
- ghc: '9.4.8'
os: ubuntu-latest
stack_yaml: 'stack-ghc-9.4.yaml'
stack_args: '--haddock --no-haddock-deps'
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: linux-x86_64
coveralls: false
- ghc: '9.2.8'
os: ubuntu-latest
stack_yaml: 'stack-ghc-9.2.yaml'
stack_args: '--haddock --no-haddock-deps'
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: linux-x86_64
coveralls: false
- ghc: '9.0.2'
os: ubuntu-latest
stack_yaml: 'stack-ghc-9.0.yaml'
stack_args: '--haddock --no-haddock-deps'
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: linux-x86_64
coveralls: false
# Current version of stack (2.7.5) cannot build foreign libraries for windows on GHC >=9.0
# We need a stack built with Cabal-3.8.1 which contains the fix https://github.com/haskell/cabal/pull/7764 .
#
# Also, GHC 9.6.5/Cabal-3.10.3.0 has a different problem regarding foreign libraries for windows
# https://github.com/haskell/cabal/issues/9982
- ghc: '8.10.7'
os: windows-latest
stack_yaml: 'stack-ghc-8.10.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: win64
coveralls: false
release: true
- ghc: '8.8.4'
os: ubuntu-latest
stack_yaml: 'stack-ghc-8.8.yaml'
stack_args: '--coverage'
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: linux-x86_64
coveralls: true
- ghc: '8.6.3'
os: windows-latest
stack_yaml: 'stack-windows-i386.yaml'
stack_args: ''
flags: '--flag toysolver:BuildToyFMF --flag toysolver:BuildSamplePrograms --flag toysolver:BuildMiscPrograms'
platform: win32
coveralls: false
release: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Write arch to stack.yaml (macos-x86_64)
if: matrix.platform == 'macos-x86_64'
run: |
echo "arch: x86_64" >> ${STACK_YAML}
- uses: haskell-actions/setup@v2
id: setup-haskell
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
stack-no-global: ${{ matrix.platform == 'macos-x86_64' || matrix.platform == 'win32' }}
cabal-update: false
- name: Setup stack to use system GHC
if: matrix.platform != 'macos-x86_64' && matrix.platform != 'win32'
run: stack config set system-ghc --global true
#- name: Fix ld path (Windows)
# if: runner.os == 'Windows'
# run: ruby misc/fix-x86_64-windows-ghc-8.10.2-settings.rb
- name: Install packages (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install ocl-icd-opencl-dev
- uses: actions/cache@v4
name: Cache ~/.stack
with:
path: ${{ steps.setup-haskell.outputs.stack-root }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('toysolver.cabal') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-
# https://github.com/commercialhaskell/stack/issues/5405
- name: Clear setup-exe-cache directory
if: runner.os == 'macOS'
continue-on-error: true
run: rm -r ~/.stack/setup-exe-cache
- name: Build dependencies
shell: bash
run: stack build --test --no-run-tests --bench --no-run-benchmarks --only-dependencies ${{ matrix.stack_args }} ${{ matrix.flags }}
- name: Build
shell: bash
run: stack build --test --no-run-tests --bench --no-run-benchmarks ${{ matrix.stack_args }} ${{ matrix.flags }}
- name: Test
shell: bash
# -j1 is for https://github.com/commercialhaskell/stack/issues/5024
run: stack test ${{ matrix.stack_args }} -j1 ${{ matrix.flags }}
timeout-minutes: 10
- name: Check IPASIR DLL dependencies
continue-on-error: true
shell: bash
run: |
if [[ ${{ runner.os }} = "macOS" ]]; then
otool -L `stack path --local-install-root`/lib/libtoysat-ipasir.dylib
elif [[ ${{ runner.os }} = "Windows" ]]; then
ldd `stack path --local-install-root`/lib/toysat-ipasir.dll
else
ldd `stack path --local-install-root`/lib/libtoysat-ipasir.so
fi
- name: Test IPASIR DLL using genipaessentials
shell: bash
run: |
if [[ ${{ matrix.platform }} = "macos-x86_64" ]]; then
stack exec -- arch -x86_64 g++ -Wall -Iapp/toysat-ipasir/ misc/genipaessentials/genipaessentials.cpp -L`stack path --local-install-root`/lib -ltoysat-ipasir -o genipaessentials
else
stack exec -- g++ -Wall -Iapp/toysat-ipasir/ misc/genipaessentials/genipaessentials.cpp -L`stack path --local-install-root`/lib -ltoysat-ipasir -o genipaessentials
fi
if [[ ${{ runner.os }} = "macOS" ]]; then
install_name_tool -add_rpath `stack path --local-install-root`/lib genipaessentials
elif [[ ${{ runner.os }} = "Windows" ]]; then
export PATH=$(cygpath -u $(stack path --local-install-root))/lib:$PATH
else
export LD_LIBRARY_PATH=`stack path --local-install-root`/lib:$LD_LIBRARY_PATH
fi
# "stack exec --" is necessary on windows-i386 for adding path of libstdc++
stack exec -- ./genipaessentials misc/genipaessentials/inputs/sat100.cnf
- name: Coveralls
if: matrix.coveralls
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar -xj
./shc --repo-token="$COVERALLS_REPO_TOKEN" toysolver TestSuite TestPolynomial
- name: Test scripts
shell: bash
run: stack runhaskell ${{ matrix.stack_args }} misc/generate_packageVersions.hs > /dev/null
- name: Build artifacts
id: build-artifact
run: stack runhaskell ${{ matrix.stack_args }} --package turtle misc/build_artifacts.hs
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: matrix.release
with:
name: binary-packages-${{ matrix.platform }}
path: |
*.tar.xz
*.7z
retention-days: 2
github-release:
name: github-release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
needs: build
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/download-artifact@v4
with:
name: binary-packages-linux-x86_64
path: binary-packages
- uses: actions/download-artifact@v4
with:
name: binary-packages-macos-aarch64
path: binary-packages
- uses: actions/download-artifact@v4
with:
name: binary-packages-macos-x86_64
path: binary-packages
- uses: actions/download-artifact@v4
with:
name: binary-packages-win32
path: binary-packages
- uses: actions/download-artifact@v4
with:
name: binary-packages-win64
path: binary-packages
- name: Upload artifacts to GitHub Release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
shopt -s nullglob
tag_name="${GITHUB_REF#refs/tags/}"
gh release create --draft --title "${tag_name}" "${tag_name}" binary-packages/*