-
Notifications
You must be signed in to change notification settings - Fork 31
335 lines (282 loc) · 10.7 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
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
name: CI
on:
push:
branches: [ main ]
pull_request:
jobs:
cabal:
runs-on: ${{ matrix.os }}
strategy:
matrix:
ghc: ['8.10', '9.0', '9.2']
os: [ubuntu-latest, macOS-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
- uses: actions/[email protected]
with:
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-
- name: Install system dependencies Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev
- name: Install system dependencies macOS
if: matrix.os == 'macOS-latest'
shell: bash
run: |
brew install pkg-config sdl2
- name: Install system dependencies Windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
for i in $(seq 5); do
choco install pkgconfiglite --download-checksum=2038c49d23b5ca19e2218ca89f06df18fe6d870b4c6b54c0498548ef88771f6f --download-checksum-type=sha256 &&
break || sleep 15;
done
curl -L https://www.libsdl.org/release/SDL2-devel-2.28.4-mingw.tar.gz | tar xz
SDL2=$(cygpath --windows --absolute "SDL2-2.28.4/x86_64-w64-mingw32")
printf "%s\n" "$SDL2/bin" >> "$GITHUB_PATH"
printf "%s\n" "PKG_CONFIG_PATH=$SDL2/lib/pkgconfig" >> "$GITHUB_ENV"
cat >> cabal.project <<EOF
package sdl2
extra-lib-dirs: $SDL2/lib/
extra-include-dirs: $SDL2/include/SDL2/
EOF
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: latest
vulkan-components: Vulkan-Headers, Vulkan-Loader, Glslang
vulkan-use-cache: true
- name: Make libvulkan.1.dylib available on OSX
if: matrix.os == 'macOS-latest'
shell: bash
run: |
file $VULKAN_SDK/lib/libvulkan.1.dylib
ln -s $VULKAN_SDK/lib/libvulkan.1.dylib /usr/local/lib/libvulkan.1.dylib
- name: Inform Cabal about Vulkan
shell: bash
run: |
cat >> cabal.project <<EOF
extra-lib-dirs: $VULKAN_SDK/lib/
extra-include-dirs: $VULKAN_SDK/include/
EOF
printf "%s\n" "$VULKAN_SDK/bin" >> "$GITHUB_PATH"
if uname -s | grep -i mingw; then sep=';'; else sep=':'; fi
printf "%s\n" "PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+${PKG_CONFIG_PATH}${sep}}$VULKAN_SDK/lib/pkgconfig" >> "$GITHUB_ENV"
# until this is fixed https://github.com/haskell/cabal/issues/7339
printf "%s\n" "DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:+${DYLD_LIBRARY_PATH}${sep}}$VULKAN_SDK/lib" >> "$GITHUB_ENV"
- name: Remove openxr
run: |
sed -ibak '/openxr/d' cabal.project
- name: Remove generator for all but 8.10 and 9.0
run: |
sed -ibak '/generate-new/d' cabal.project
if: matrix.ghc != '8.10' || matrix.ghc != '9.0'
- run: cabal update
- run: |
if command -v glslc &> /dev/null; then
cabal configure -fgeneric-instances -f-raytracing -fhave-shaderc
else
echo "glslc could not be found"
cabal configure -fgeneric-instances -f-raytracing -f-have-shaderc
fi
shell: bash
- name: Install dependencies
run: cabal build --only-dependencies --enable-tests --enable-benchmarks all
- name: Build vulkan
run: cabal build --enable-tests --enable-benchmarks vulkan
- name: Build VulkanMemoryAllocator
run: cabal build --enable-tests --enable-benchmarks VulkanMemoryAllocator
- name: Build vulkan-utils
run: cabal build --enable-tests --enable-benchmarks vulkan-utils
- name: Build vulkan-examples
run: cabal build --enable-tests --enable-benchmarks vulkan-examples
- run: cabal check
- name: Build documentation
run: |
cabal haddock
cabal haddock VulkanMemoryAllocator
cabal haddock vulkan-utils
stack:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
stack-args: ['--flag vulkan:generic-instances --flag VulkanMemoryAllocator:generic-instances --flag vulkan-examples:-raytracing --flag vulkan-examples:-have-shaderc --system-ghc']
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: haskell/actions/setup@v2
with:
stack-version: 'latest'
enable-stack: true
ghc-version: '8.10'
- name: Cache stack things
uses: actions/[email protected]
with:
path: |
~/.stack
.stack-work
key: ${{ runner.os }}-stack-global-${{ matrix.stack-args }}-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-${{ matrix.stack-args }}
${{ runner.os }}-stack-global
- name: Set up yq
uses: frenck/action-setup-yq@v1
with: {version: v4.30.5} # frenck/action-setup-yq#35
- name: Install system dependencies Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev
- name: Install system dependencies Windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
for i in $(seq 5); do
choco install pkgconfiglite --download-checksum=2038c49d23b5ca19e2218ca89f06df18fe6d870b4c6b54c0498548ef88771f6f --download-checksum-type=sha256 &&
break || sleep 15;
done
curl -L https://www.libsdl.org/release/SDL2-devel-2.0.12-mingw.tar.gz | tar xz
SDL2=$(cygpath --windows --absolute "SDL2-2.0.12/x86_64-w64-mingw32")
printf "%s\n" "$SDL2/bin" >> "$GITHUB_PATH"
printf "%s\n" "PKG_CONFIG_PATH=$SDL2/lib/pkgconfig" >> "$GITHUB_ENV"
yq --inplace ".\"extra-lib-dirs\" += [\"$SDL2/lib/\"]" stack.yaml
yq --inplace ".\"extra-include-dirs\" += [\"$SDL2/include/\"]" stack.yaml
- name: Install system dependencies macOS
if: matrix.os == 'macOS-latest'
shell: bash
run: |
brew install pkg-config sdl2
- name: Prepare Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: latest
vulkan-components: Vulkan-Headers, Vulkan-Loader, Glslang
vulkan-use-cache: true
- name: Inform Stack about Vulkan
shell: bash
run: |
yq --inplace ".\"extra-lib-dirs\" += [\"$VULKAN_SDK/lib/\"]" stack.yaml
yq --inplace ".\"extra-include-dirs\" += [\"$VULKAN_SDK/include/\"]" stack.yaml
printf "%s\n" "$VULKAN_SDK/bin" >> "$GITHUB_PATH"
if uname -s | grep -i mingw; then sep=';'; else sep=':'; fi
printf "%s\n" "PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+${PKG_CONFIG_PATH}${sep}}$VULKAN_SDK/lib/pkgconfig" >> "$GITHUB_ENV"
# until this is fixed https://github.com/haskell/cabal/issues/7339
printf "%s\n" "DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:+${DYLD_LIBRARY_PATH}${sep}}$VULKAN_SDK/lib" >> "$GITHUB_ENV"
- name: Remove openxr
run: |
sed -ibak '/openxr/d' stack.yaml
- name: Install dependencies
shell: bash
run: stack build $ARGS --test --bench --only-dependencies
env:
ARGS: ${{ matrix.stack-args }}
- name: Build
shell: bash
run: stack build $ARGS
env:
ARGS: ${{ matrix.stack-args }}
- name: Build documentation
shell: bash
run: stack haddock $ARGS
env:
ARGS: ${{ matrix.stack-args }}
nix:
runs-on: ubuntu-latest
strategy:
matrix:
ghc: ['"ghc810"', '"ghc90"', '"ghc92"']
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15
with:
name: vulkan-haskell
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-build --arg compiler '${{ matrix.ghc }}' -A vulkan
- run: nix-build --arg compiler '${{ matrix.ghc }}' -A VulkanMemoryAllocator
- run: nix-build --arg compiler '${{ matrix.ghc }}' -A vulkan-utils
- run: nix-build --arg compiler '${{ matrix.ghc }}' -A openxr
- run: nix-build --arg compiler '${{ matrix.ghc }}' ./nix/haskell-packages.nix --arg openxrNoVulkan true -A openxr
- run: nix-build --arg compiler '${{ matrix.ghc }}' -A vulkan-examples
- run: nix-build --arg compiler '${{ matrix.ghc }}' -j1 nix/release.nix
- run: nix-build --arg compiler '${{ matrix.ghc }}' nix/release.nix -A docs
- run: nix-build --arg compiler '${{ matrix.ghc }}' nix/release.nix -A docs-combined
- run: XDG_DATA_DIRS=$(mktemp -d) nix-shell --arg compiler '${{ matrix.ghc }}' examples --run 'ghc-pkg list'
nix-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15
with:
name: vulkan-haskell
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-build nix/release.nix -j1 -A sdistTest
nix-generator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15
with:
name: vulkan-haskell
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-build -A generate-new
nix-shell-profiling:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15
with:
name: vulkan-haskell
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: XDG_DATA_DIRS=$(mktemp -d) nix-shell examples --arg buildProfiling true --run 'ghc-pkg list'
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shellcheck
run: |
sudo apt-get install fd-find
- name: Check scripts with shellcheck
run: |
fdfind .sh$ . \
--exclude VulkanMemoryAllocator/VulkanMemoryAllocator \
--exclude generate-new/Vulkan-Docs \
--exclude generate-new/OpenXR-Docs \
--exec shellcheck