-
Notifications
You must be signed in to change notification settings - Fork 13
304 lines (252 loc) · 8.62 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-linux:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install unit tests requirements
run: |
python3 -m venv .env
. .env/bin/activate
pip install -r tests/unit_tests/requirements.txt
- name: Build
run: |
. .env/bin/activate
cmake . \
-Bbuild \
-DCMAKE_BUILD_TYPE=Release
cmake --build build
- name: Test
working-directory: build
run: |
ctest --output-on-failure
- name: Parse C++ source files (WASI toolchain)
run: |
for i in src/parser/cxx/*.cc src/lsp/cxx/lsp/*.cc src/frontend/cxx/*.cc; do
echo "Parsing $i"
./build/src/frontend/cxx \
-I src/parser \
-I src/lsp \
-I build/_deps/fmt-src/include \
-I build/_deps/utfcpp-src/source \
-I build/_deps/flatbuffers-src/include \
-I build/_deps/nlohmann_json-src/include \
-I build/src/parser \
-DCXX_NO_FILESYSTEM \
-DCXX_NO_THREADS \
$i
done
- name: Parse C++ source files (Linux toolchain)
run: |
for i in src/parser/cxx/*.cc src/lsp/cxx/lsp/*.cc src/frontend/cxx/*.cc; do
echo "Parsing $i"
./build/src/frontend/cxx \
-toolchain linux \
-I src/parser \
-I src/lsp \
-I build/_deps/fmt-src/include \
-I build/_deps/utfcpp-src/source \
-I build/_deps/flatbuffers-src/include \
-I build/_deps/nlohmann_json-src/include \
-I build/src/parser \
$i
done
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install unit tests requirements
run: |
pip install -r tests\unit_tests\requirements.txt
- name: Build
run: |
cmake . -Bbuild
cmake --build build --config Release
- name: Test
working-directory: build
run: |
ctest --verbose -C Release
build-emscripten:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup emscripten cache
uses: actions/cache@v4
with:
path: ~/.emscripten-cache
key: ${{ runner.os }}-emscripten
restore-keys: |
${{ runner.os }}-emscripten
- name: Install dependenciesch
run: |
npm ci
- name: Prettier
run: |
npm -w cxx-frontend run prettier
- name: Build
run: |
npm -w cxx-frontend run build
npm -w cxx-frontend pack
- name: Build Docs
working-directory: packages/cxx-frontend
run: |
npm -w cxx-frontend run docs
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cxx-frontend-dist
path: |
packages/cxx-frontend/dist/
packages/cxx-frontend/docs/
retention-days: 1
build-macos:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Install unit tests requirements
run: |
python3 -m venv .env
. .env/bin/activate
pip install -r tests/unit_tests/requirements.txt
- name: Build
run: |
. .env/bin/activate
cmake . \
-Bbuild \
-DCMAKE_BUILD_TYPE=Release
cmake --build build
- name: Test
working-directory: build
run: |
ctest --verbose
- name: Parse C++ source files (macOS toolchain)
run: |
for i in src/parser/cxx/*.cc src/lsp/cxx/lsp/*.cc src/frontend/cxx/*.cc; do
echo "Parsing $i"
./build/src/frontend/cxx \
-toolchain macos \
-I src/parser \
-I src/lsp \
-I build/_deps/fmt-src/include \
-I build/_deps/utfcpp-src/source \
-I build/_deps/flatbuffers-src/include \
-I build/_deps/nlohmann_json-src/include \
-I build/src/parser \
$i
done
build-wasi:
runs-on: ubuntu-24.04
env:
WASMTIME_VERSION: 25.0.2
steps:
- uses: actions/checkout@v4
- name: Build
run: |
npm ci
npm run build:wasi
- name: Install wasmtime
run: |
wget -nd -P /tmp/ https://github.com/bytecodealliance/wasmtime/releases/download/v${{ env.WASMTIME_VERSION }}/wasmtime-v${{ env.WASMTIME_VERSION }}-$(uname -m)-linux.tar.xz
tar -C /usr/local/bin -xvf /tmp/wasmtime-v${{ env.WASMTIME_VERSION }}-$(uname -m)-linux.tar.xz --strip-components=1 --wildcards 'wasmtime-*-linux/wasmtime'
- name: Test
run: |
wasmtime \
-W threads=y -S threads=y \
--dir ${{github.workspace}}/build.wasi/install::/ \
--dir tests::tests \
${{github.workspace}}/build.wasi/install/usr/bin/cxx.wasm -v tests/manual/source.cc
- name: Parse C++ source files (wasmtime runtime)
run: |
PATH=~/wasmtime-v${{ env.WASMTIME_VERSION }}-x86_64-linux:$PATH
for i in src/parser/cxx/*.cc src/lsp/cxx/lsp/*.cc src/frontend/cxx/*.cc; do
echo "Parsing $i"
wasmtime \
-W threads=y -S threads=y \
--dir=src::/src \
--dir=build.wasi/_deps::/build.wasi/_deps \
--dir=build.wasi/src/parser::build.wasi/src/parser \
--dir=build.wasi/src/lsp::build.wasi/src/lsp \
--dir=build.wasi/install/usr::/usr \
build.wasi/install/usr/bin/cxx.wasm \
-I src/parser \
-I src/lsp \
-I build.wasi/_deps/fmt-src/include \
-I build.wasi/_deps/utfcpp-src/source \
-I build.wasi/_deps/flatbuffers-src/include \
-I build.wasi/_deps/nlohmann_json-src/include \
-I build.wasi/src/parser \
-DCXX_NO_FILESYSTEM \
-DCXX_NO_THREADS \
$i
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cxx-wasi
path: |
build.wasi/install/
!build.wasi/install/usr/lib/*.a
!build.wasi/install/usr/lib/cmake
!build.wasi/install/usr/lib/wasi-sysroot/lib
!build.wasi/install/usr/lib/wasi-sysroot/share
!build.wasi/install/usr/lib/wasi-sysroot/include/
!build.wasi/install/usr/include/wasm32-wasi-threads
!build.wasi/install/usr/include/wasm32-wasip1
!build.wasi/install/usr/include/wasm32-wasip1-threads
!build.wasi/install/usr/include/wasm32-wasip2
retention-days: 1
release-please:
runs-on: ubuntu-24.04
if: false && github.repository == 'robertoraggi/cplusplus' && github.ref == 'refs/heads/main'
steps:
- uses: GoogleCloudPlatform/release-please-action@v3
with:
token: ${{ secrets.RELEASE_TOKEN }}
release-type: node
package-name: cplusplus
extra-files: |
packages/cxx-frontend/package.json
templates/cxx-parse/package.json
templates/cxx-browser-esm-vite/package.json
templates/cxx-parse-esm/package.json
build-storybook:
runs-on: ubuntu-24.04
needs: build-emscripten
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: cxx-frontend-dist
path: packages/cxx-frontend
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Build
run: |
npm ci
npm run build:storybook
mkdir -p packages/cxx-storybook/storybook-static/docs
cp -a packages/cxx-frontend/docs/. packages/cxx-storybook/storybook-static/docs
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: packages/cxx-storybook/storybook-static
deploy-storybook:
name: Deploy Storybook
if: github.repository == 'robertoraggi/cplusplus' && github.ref == 'refs/heads/main'
needs: build-storybook
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-24.04
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4