forked from srcML/srcML
-
Notifications
You must be signed in to change notification settings - Fork 0
384 lines (340 loc) · 12.6 KB
/
BuildWindows.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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
---
name: Build Windows
on: workflow_dispatch
jobs:
build:
runs-on: windows-latest
env:
SCCACHE_GHA_ENABLED: "true"
timeout-minutes: 30
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Windows
uses: microsoft/[email protected]
- name: Restore artifacts, or run vcpkg, build (and cache artifacts as post step)
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgGitCommitId: 'acc3bcf76b84ae5041c86ab55fe138ae7b8255c7'
- name: Fix vcpkg
shell: bash
run: |
mkdir "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/vcpkg/scripts/msys"
curl -L https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/cmake/compile_wrapper_consider_clang-cl.patch -o "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/vcpkg/scripts/msys/compile_wrapper_consider_clang-cl.patch"
- name: Setup devcmd to use cl.exe
uses: ilammy/[email protected]
- name: Configure sccache
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Create build directory
shell: bash
run: |
cmake --version
mkdir build
echo $VCPKG_ROOT/vcpkg list
# - name: Run CMake with vcpkg.json manifest
# uses: lukka/run-cmake@v10
# with:
# configurePreset: msvc
# configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache']"
# vcpkgJsonGlob: '${{ github.workspace }}/vcpkg.json'
- name: CMake Setup on Windows
shell: bash
working-directory: build
run: |
export UseMultiToolTask=true
cmake .. --preset msvc-sccache
- name: Build
shell: bash
working-directory: build
continue-on-error: true
run: |
export UseMultiToolTask=true
cmake --build . --config Release
- name: Package
working-directory: build
continue-on-error: true
run: |
cpack -V --preset msvc
# - uses: actions/upload-artifact@v3
# with:
# name: wix.log
# # if: failure()
# path: build/dist/_CPack_Packages/win64/WIX/wix.log
- uses: actions/upload-artifact@v3
with:
name: installers
path: |
build/dist/*.msi
build/dist/*.zip
build/dist/*.exe
build/dist/*.nupkg
# - name: Install from build
# working-directory: build
# continue-on-error: true
# run: |
# cmake --build . --config Release --target install
# # - name: Clean build
# # working-directory: build
# # continue-on-error: true
# # run: |
# # cmake --build . --config Release --target clean
# # cmake . -DSRCML_TEST_INSTALLED=ON
# - name: Set PATH for Windows
# shell: bash
# working-directory: build
# continue-on-error: true
# run: |
# echo "/c/Program Files/srcML/bin" >> $GITHUB_PATH
# - name: Run Installed srcml
# shell: bash
# working-directory: build
# continue-on-error: true
# run: |
# EOL="\r\n"
# export PATH=$PATH:"/c/Program Files/srcML/bin"
# SRCML_HOME="/c/Program Files/srcML/bin"
# ls -lh "$SRCML_HOME"
# SRCML="$SRCML_HOME/srcml.exe"
# ls -lh "$SRCML"
# export MSYS2_ARG_CONV_EXCL="*"
# diff='diff -Z '
# "$SRCML" --version
# "$SRCML" --text="int a;" -l C++
# touch "a.cpp"
# "$SRCML" a.cpp
# echo "a;" >> a.cpp
# "$SRCML" a.cpp
# echo "b;" >> b.cpp
# "$SRCML" a.cpp b.cpp
# - name: Create build examples directory
# shell: bash
# continue-on-error: true
# run: |
# mkdir build2
# - name: Build examples
# shell: bash
# working-directory: build2
# continue-on-error: true
# run: |
# cmake "/c/Program Files/srcML/share/srcml/examples" -DsrcML_DIR="C:/Program Files/srcML/cmake" -G Ninja
# ninja
# - name: Run examples
# shell: bash
# working-directory: build2
# continue-on-error: true
# run: |
# ls *.exe
# ./srcml_copy_archive.exe || echo $?
# ./srcml_create_archive_fd.exe || echo $?
# ./srcml_create_archive_file.exe || echo $?
# ./srcml_create_archive_filename.exe || echo $?
# ./srcml_create_archive_full.exe || echo $?
# ./srcml_direct_language.exe || echo $?
# ./srcml_direct_language_list.exe || echo $?
# ./srcml_direct_language_xml.exe || echo $?
# ./srcml_direct_src2srcml.exe || echo $?
# ./srcml_direct_srcml2src.exe || echo $?
# ./srcml_list.exe || echo $?
# ./srcml_read_archive_fd.exe || echo $?
# ./srcml_read_archive_file.exe || echo $?
# ./srcml_read_archive_filename.exe || echo $?
# ./srcml_read_archive_full.exe || echo $?
# ./srcml_read_archive_memory.exe || echo $?
# ./srcml_relaxng.exe || echo $?
# ./srcml_sort_archive.exe || echo $?
# ./srcml_split_archive.exe || echo $?
# ./srcml_transform.exe || echo $?
# ./srcml_xpath.exe || echo $?
# ./srcml_xslt.exe || echo $?
test-installer:
needs: build
runs-on: windows-latest
strategy:
matrix:
installer: [msi, inno, nuget]
steps:
# Download the installer artifact
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installers
# - shell: bash
# continue-on-error: true
# run: |
# ls -lh
- name: Install package Wix msi
continue-on-error: true
if: ${{ matrix.installer == 'msi' }}
run: msiexec /i srcml-1.0.0-windows-x86_64.msi /quiet /norestart /L*vx .\msi.log
- uses: actions/upload-artifact@v3
if: ${{ matrix.installer == 'msi' }}
with:
name: msi.log
path: ./msi.log
- name: Install package Inno Setup
continue-on-error: true
if: ${{ matrix.installer == 'inno' }}
run: .\srcml-1.0.0-windows-x86_64.exe /VERYSILENT
# - uses: actions/upload-artifact@v3
# if: ${{ matrix.installer == 'msi' }}
# with:
# name: msi.log
# path: ./msi.log
- name: Install package Nuget
continue-on-error: true
if: ${{ matrix.installer == 'nuget' }}
run: nuget install srcml-1.0.0-windows-x86_64.nupkg
# - uses: actions/upload-artifact@v3
# if: ${{ matrix.installer == 'msi' }}
# with:
# name: msi.log
# path: ./msi.log
- name: Set PATH for Windows
shell: bash
continue-on-error: true
run: |
echo "/c/Program Files/srcML/bin" >> $GITHUB_PATH
- name: Run Installed srcml
shell: bash
continue-on-error: true
run: |
srcml --help
srcml --text="a;" -l C++
# - name: Create build examples directory
# shell: bash
# continue-on-error: true
# run: |
# mkdir build3
# - name: Build examples
# shell: bash
# working-directory: build3
# continue-on-error: true
# run: |
# cmake "/c/Program Files/srcML/share/srcml/examples" -G Ninja
# ninja
# - name: Run examples
# shell: bash
# working-directory: build3
# continue-on-error: true
# run: |
# ./srcml_copy_archive.exe || echo $?
# ./srcml_create_archive_fd.exe || echo $?
# ./srcml_create_archive_file.exe || echo $?
# ./srcml_create_archive_filename.exe || echo $?
# ./srcml_create_archive_full.exe || echo $?
# ./srcml_direct_language.exe || echo $?
# ./srcml_direct_language_list.exe || echo $?
# ./srcml_direct_language_xml.exe || echo $?
# ./srcml_direct_src2srcml.exe || echo $?
# ./srcml_direct_srcml2src.exe || echo $?
# ./srcml_list.exe || echo $?
# ./srcml_read_archive_fd.exe || echo $?
# ./srcml_read_archive_file.exe || echo $?
# ./srcml_read_archive_filename.exe || echo $?
# ./srcml_read_archive_full.exe || echo $?
# ./srcml_read_archive_memory.exe || echo $?
# ./srcml_relaxng.exe || echo $?
# ./srcml_sort_archive.exe || echo $?
# ./srcml_split_archive.exe || echo $?
# ./srcml_transform.exe || echo $?
# ./srcml_xpath.exe || echo $?
# ./srcml_xslt.exe || echo $?
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup msys2 with additional client-test packages for Windows
uses: msys2/setup-msys2@v2
continue-on-error: true
with:
install: >-
zip
cpio
diffutils
util-linux
cmake
libxml2
- name: Create build directory
shell: bash
run: |
mkdir build
- name: Build
shell: bash
working-directory: build
continue-on-error: true
run: |
export UseMultiToolTask=true
cmake ../test/client
- name: Windows Client Tests on Installed srcml
shell: msys2 {0}
working-directory: build
timeout-minutes: 10
continue-on-error: true
run: |
# export SRCML_HOME="/c/Program Files/srcML/bin/"
export SRCML_HOME="/c/Program Files/srcML/bin"
ctest -C Release -VV
- uses: actions/upload-artifact@v3
with:
name: ClientTest.windows-latest.log
path: build/Testing/Temporary/LastTest.log
# - name: Build libsrcml Tests
# shell: bash
# working-directory: build
# continue-on-error: true
# run: |
# export UseMultiToolTask=true
# export PATH=$PATH:"/c/Program Files/srcML/bin/"
# echo "C:\Program Files\srcML\bin" >> $GITHUB_PATH
# SRCML_HOME="/c/Program Files/srcML/bin/"
# cmake . -DBUILD_LIBSRCML_TESTS=ON
# cmake --build . --config Release --target build_libsrcml_tests
# - name: Check dependents
# shell: bash
# working-directory: build
# continue-on-error: true
# run: |
# dumpbin -dependents "/c/Program Files/srcML/bin/srcml.exe" || true
# dumpbin -dependents "/c/Program Files/srcML/bin/archive.dll" || true
# dumpbin -dependents "/c/Program Files/srcML/bin/libcurl.dll" || true
# dumpbin -dependents "/c/Program Files/srcML/bin/libsrcml.dll" || true
# dumpbin -dependents "/c/Program Files/srcML/bin/libxml2.dll" || true
# dumpbin -dependents "/c/Program Files/srcML/bin/libexslt.dll" || true
# dumpbin -dependents "/c/Program Files/srcML/bin/libxslt.dll" || true
# dumpbin -dependents "/c/Program Files/srcML/bin/iconv-2.dll" || true
# dumpbin -exports "/c/Program Files/srcML/bin/libsrcml.dll" || true
# - name: Run libsrcml Tests on Installed libsrcml
# shell: bash
# working-directory: build
# continue-on-error: true
# run: |
# ctest -C Release -R ^test_
# - uses: actions/upload-artifact@v3
# with:
# name: libsrcmlTest.windows-latest.log
# path: build/Testing/Temporary/LastTest.log
# - name: Generate Parser Tests
# shell: bash
# working-directory: build
# continue-on-error: true
# run: |
# export PATH=$PATH:"/c/Program Files/srcML/bin/"
# ls -lh "/c/Program Files/srcML/bin/"
# echo "C:\Program Files\srcML\bin" >> $GITHUB_PATH
# cmake . -DBUILD_PARSER_TESTS=ON
# cmake --build . --config Release --target gen_parser_tests
# - name: Run Parser Tests
# shell: bash
# working-directory: build
# continue-on-error: true
# run: |
# srcml --parser-test test/parser/testsuite | tee ParserTest.log
# - uses: actions/upload-artifact@v3
# with:
# name: ParserTest.windows-latest.log
# path: build/ParserTest.log