-
Notifications
You must be signed in to change notification settings - Fork 28
355 lines (294 loc) · 11.8 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
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
name: "Test"
on:
pull_request:
push:
branches:
- master
tags:
- "v*"
jobs:
tarball:
runs-on: ubuntu-latest
name: Tarball
steps:
- name: Clone wake
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Deps
run: sudo apt-get update && sudo apt-get install -y build-essential fuse libfuse-dev libsqlite3-dev libgmp-dev libncurses5-dev pkg-config git g++ gcc libre2-dev python3-sphinx clang-format-12
- name: Check C/C++ Formatting
run: clang-format-12 --style=file --Werror -n $(./scripts/which_clang_files all)
- name: Build Tarball
run: make tarball
- name: Run Tests
run: make test && make unittest
- name: Check Wake Formatting
run: ./bin/wake-format.native-cpp14-release --auto --dry-run
- name: Checkout postgres
run: pushd /var/tmp/ && git clone --depth 1 https://github.com/postgres/postgres.git && cd postgres && git fetch origin c372fbbd8e911f2412b80a8c39d7079366565d67 && git checkout c372fbbd8e911f2412b80a8c39d7079366565d67 && popd
- name: Build postgres
run: pushd /var/tmp/postgres && ./configure --prefix /var/tmp/pg-server && make install && popd
- name: Run Remote Cache Tests
run: POSTGRES_DIR=/var/tmp/pg-server make remoteCacheTests
- name: Generate Docs
run: mkdir www && ./bin/wake --no-workspace --html > www/index.html
- name: wake to rst
run: PATH=$(pwd)/bin:$PATH PYTHONPATH=$(pwd)/scripts python3 scripts/wake2rst.py
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: tarball
path: wake_*.tar.xz
- name: Upload Dockerfiles
uses: actions/upload-artifact@v3
with:
name: dockerfiles
path: .github/workflows/dockerfiles/
retention-days: 1
- name: Upload debian files
uses: actions/upload-artifact@v3
with:
name: debian
path: debian
retention-days: 1
- name: Upload test artifacts
uses: actions/upload-artifact@v3
with:
name: tests
include-hidden-files: true
path: tests
retention-days: 1
- name: Upload index.html
uses: actions/upload-artifact@v3
with:
name: index.html
path: www/index.html
retention-days: 1
- name: Upload html
uses: actions/upload-artifact@v3
with:
name: html
path: scripts/sphinx/build/html
retention-days: 1
docker_builds:
runs-on: ubuntu-latest
needs: tarball
name: Build ${{ matrix.target }}
strategy:
matrix:
include:
# - target: alpine
# dockerfile: alpine
# extra_docker_build_args: ''
# extra_docker_run_args: ''
# build_cmd: make -C wake-* static
# test_cmd: tar xvJf wake-*/wake-static_* && cd tests && ../wake-*/bin/wake -x Unit
# install_src_glob: build/wake-*/wake-static_*
- target: debian_bullseye
dockerfile: debian-bullseye
extra_docker_build_args: ''
extra_docker_run_args: -w /$(ls -d build/wake-*)
build_cmd: debuild -us -uc
test_cmd: dpkg -i *.deb && cd tests && wake runTests
install_src_glob: build/*.deb build/*.xz build/*.changes build/*.dsc
- target: rocky_8
dockerfile: rocky-8
extra_docker_build_args: ''
extra_docker_run_args: ''
build_cmd: rpmbuild -ta --define "_rpmdir /build" wake_*.tar.xz
test_cmd: rpm -i x86_64/*.rpm && cd tests && wake runTests
install_src_glob: build/x86_64/*.rpm
- target: rocky_9
dockerfile: rocky-9
extra_docker_build_args: ''
extra_docker_run_args: ''
build_cmd: rpmbuild -ta --define "_rpmdir /build" wake_*.tar.xz
test_cmd: rpm -i x86_64/*.rpm && cd tests && wake runTests
install_src_glob: build/x86_64/*.rpm
- target: ubuntu_22_04
dockerfile: ubuntu-22.04
extra_docker_build_args: ''
extra_docker_run_args: -w /$(ls -d build/wake-*)
build_cmd: debuild -us -uc
test_cmd: dpkg -i *.deb && cd tests && wake runTests
install_src_glob: build/*.deb build/*.xz build/*.changes build/*.dsc
- target: fedora_38
dockerfile: fedora-38
extra_docker_build_args: ''
extra_docker_run_args: ''
build_cmd: rpmbuild -ta --define "_rpmdir /build" wake_*.tar.xz
test_cmd: rpm -i x86_64/*.rpm && cd tests && wake runTests
install_src_glob: build/x86_64/*.rpm
- target: vscode
dockerfile: node
extra_docker_build_args: ''
extra_docker_run_args: -u build
build_cmd: make -C wake-* vscode
test_cmd: ls # no-op
install_src_glob: build/wake-*/extensions/vscode/wake-*.vsix
- target: wasm
dockerfile: wasm
extra_docker_build_args: ''
extra_docker_run_args: -u build
build_cmd: make -C wake-* wasm
test_cmd: ls # no-op
install_src_glob: build/wake-*/lib/wake/lsp-wake.wasm*
steps:
- name: Create target directories
run: mkdir dockerfiles && mkdir -p build/tests && mkdir build/debian && chmod ugo+rwx build
- name: Download Tarball
uses: actions/download-artifact@v3
with:
name: tarball
path: build
- name: Download Debian Artifacts
uses: actions/download-artifact@v3
with:
name: debian
path: build/debian
- name: Download Test Artifacts
uses: actions/download-artifact@v3
with:
name: tests
path: build/tests
- name: Download Dockerfiles
uses: actions/download-artifact@v3
with:
name: dockerfiles
path: dockerfiles
- name: Create orig file
run: x=(build/wake_*.tar.xz); y=${x%.tar.xz}; cp "$x" "build/${y##*/}.orig.tar.xz"
- name: Uncompress tarball
run: tar xvJf build/wake_*.orig.tar.xz -C build
- name: Set tests as executable
run: chmod -R +x build/tests
- name: Merge debian artifacts into tarball artifacts
run: cp -a build/debian build/wake-*
- name: Build docker image
run: docker build -f dockerfiles/${{ matrix.dockerfile }} ${{ matrix.extra_docker_build_args }} -t wake-${{ matrix.dockerfile }} .
- name: Build
run: docker run --rm --mount type=bind,source=$PWD/build,target=/build --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined ${{ matrix.extra_docker_run_args }} wake-${{ matrix.dockerfile }} /bin/sh -c '${{ matrix.build_cmd }}'
- name: Test
run: docker run --rm --mount type=bind,source=$PWD/build,target=/build --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined wake-${{ matrix.dockerfile }} /bin/sh -c '${{ matrix.test_cmd }}'
- name: Install
run: install -D -t release/${{ matrix.target }} ${{ matrix.install_src_glob }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: release_${{ matrix.target }}
path: release/${{ matrix.target }}
docs:
runs-on: ubuntu-latest
needs: tarball
name: Docs
steps:
- name: Download index.html
uses: actions/download-artifact@v3
with:
name: index.html
- name: Download html
uses: actions/download-artifact@v3
with:
name: html
- name: Make .nojekyll
run: touch .nojekyll
- name: Upload
uses: actions/upload-pages-artifact@v1
with:
path: .
deploy_docs:
# Only run the 'deploy_docs' job if this workflow was triggered by a push to master
if: github.event_name == 'push' && github.ref_type == 'branch' && github.ref_name == 'master'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: docs
name: Deploy Docs to GH Pages
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v1
release:
# Only run the 'release' job if this workflow was triggered by the creation of a tag
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: [tarball, docker_builds]
name: Create Release
steps:
- name: Download Tarball
uses: actions/download-artifact@v3
with:
name: tarball
path: tarball
- name: Download VSCode
uses: actions/download-artifact@v3
with:
name: release_vscode
path: vscode
# We don't actually release/upload wasm. It's build to maintain buildabilty
# - name: Download wasm
# uses: actions/download-artifact@v3
# with:
# name: release_wasm
# path: wasm
# We don't actually release/upload wake_static. Wake is unsupported on old versions
# of alpine, and releasing a "wake_static" artifact is very misleading and prone to
# user error and confusion
# - name: Download Alpine
# uses: actions/download-artifact@v3
# with:
# name: release_alpine
# path: alpine
- name: Download Debian Bullseye
uses: actions/download-artifact@v3
with:
name: release_debian_bullseye
path: debian_bullseye
- name: Download Rocky 8
uses: actions/download-artifact@v3
with:
name: release_rocky_8
path: rocky_8
- name: Download Rocky 9
uses: actions/download-artifact@v3
with:
name: release_rocky_9
path: rocky_9
- name: Download Ubuntu 22.04
uses: actions/download-artifact@v3
with:
name: release_ubuntu_22_04
path: ubuntu_22_04
- name: Download Fedora 38
uses: actions/download-artifact@v3
with:
name: release_fedora_38
path: fedora_38
- name: Rename artifacts
run: |
TAG="${{ github.ref_name }}"
VERSION="${TAG:1}"
cp rocky_8/wake-*-1.x86_64.rpm rocky_8-wake-${VERSION}-1.x86_64.rpm
cp rocky_9/wake-*-1.x86_64.rpm rocky_9-wake-${VERSION}-1.x86_64.rpm
cp debian_bullseye/wake_*-1_amd64.deb debian-bullseye-wake_${VERSION}-1_amd64.deb
cp ubuntu_22_04/wake_*-1_amd64.deb ubuntu-22-04-wake_${VERSION}-1_amd64.deb
cp fedora_38/wake-*-1.x86_64.rpm fedora_38-wake-${VERSION}-1.x86_64.rpm
- name: Create Release
# v1.2.1 -> 919008cf3f741b179569b7a6fb4d8860689ab7f0
uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0
with:
draft: true
repo_token: '${{ secrets.GITHUB_TOKEN }}'
files: |
tarball/wake_*.tar.xz
vscode/wake-*.vsix
rocky_8-wake-*-1.x86_64.rpm
rocky_9-wake-*-1.x86_64.rpm
debian-bullseye-wake_*-1_amd64.deb
ubuntu-22-04-wake_*-1_amd64.deb
fedora_38-wake-*-1.x86_64.rpm