-
Notifications
You must be signed in to change notification settings - Fork 9
352 lines (310 loc) · 11.4 KB
/
build_test.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
name: build_test
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
CCACHE_MAXSIZE: 500M
CCACHE_KEY_SUFFIX: r22
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-24.04, compiler: clang-18 }
- { os: ubuntu-24.04, compiler: gcc-14 }
- { os: macos-13, compiler: clang-14 }
- { os: macos-14, compiler: armv8-clang-14 }
- { os: windows-2022, compiler: msvc-1940 }
steps:
- name: checkout
uses: actions/checkout@v4
- name: ubuntu install ccache
if: runner.os == 'Linux'
run: |
sudo apt install ccache
ccache -V
- name: macos install ccache
if: runner.os == 'macOS'
run: |
brew install ccache
ccache -V
- name: setup python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install python dependencies
run: pip install conan
- name: conan remote
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
- name: conan config
run: conan config install .github/config/${{ matrix.os }}-${{ matrix.compiler }}/conan
- name: conan install
run: conan install . --output-folder=build --build=never
- name: cache
uses: actions/cache@v4
with:
path: |
~/.ccache
/Users/runner/Library/Caches/ccache
key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ env.CCACHE_KEY_SUFFIX }}
restore-keys: |
${{ matrix.os }}-${{ matrix.compiler }}-
- name: cmake
if: runner.os != 'Windows'
run: >
cmake -B build -S .
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_FLAGS="-Werror"
-DCMAKE_INSTALL_PREFIX=install
-DODR_TEST=ON
-DWITH_PDF2HTMLEX=ON
-DWITH_WVWARE=ON
- name: cmake
if: runner.os == 'Windows'
run: >
cmake -B build -S .
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=install
-DODR_TEST=ON
-DWITH_PDF2HTMLEX=OFF
-DWITH_WVWARE=OFF
- name: build
run: cmake --build build --config Release
- name: install
run: cmake --build build --target install --config Release
- name: upload binaries to github
uses: actions/upload-artifact@v4
with:
name: bin-${{ matrix.os }}-${{ matrix.compiler }}
path: |
install
build/test/odr_test
build/test/Release/odr_test.exe
- name: Artifact .conan2/p dir
uses: actions/upload-artifact@v4
with:
name: conan2-${{ matrix.os }}-${{ matrix.compiler }}
path: ~/.conan2/p
if-no-files-found: error
compression-level: 0
docker:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-24.04, compiler: clang-18 }
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/odr_core_cli
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha
- name: download binaries
uses: actions/download-artifact@v4
with:
name: bin-${{ matrix.os }}-${{ matrix.compiler }}
path: cli
- name: Build and push
uses: docker/build-push-action@v5
with:
context: cli
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/odr_core_cli:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/odr_core_cli:buildcache,mode=max
# TODO try to run it
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-24.04, compiler: clang-18 }
- { os: ubuntu-24.04, compiler: gcc-14 }
- { os: macos-13, compiler: clang-14 }
- { os: macos-14, compiler: armv8-clang-14 }
# Windows test disabled because:
# Running main() from C:\Users\runneradmin\.conan2\p\b\gtestdd9407d368b89\b\src\googletest\src\gtest_main.cc
# [ FATAL ] C:/Users/runneradmin/.conan2/p/gtest28fa6787e7f6e/p/include\gtest/internal/gtest-param-util.h(585):: Condition IsValidParamName(param_name) failed. Parameterized test name 'odr_private\docx\03_smpldap_docx' is invalid, in D:\a\OpenDocument.core\OpenDocument.core\test\src\html_output_test.cpp line 129
# - { os: windows-2022, compiler: msvc-1940 }
steps:
- name: checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_ANDIWAND }}
submodules: true
- name: ubuntu install tidy
if: runner.os == 'Linux'
run: sudo apt install tidy
- name: macos install tidy
if: runner.os == 'macOS'
run: brew install tidy-html5
- name: set up python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install python dependencies
run: pip install -r test/scripts/requirements.txt
- name: download binaries
uses: actions/download-artifact@v4
with:
name: bin-${{ matrix.os }}-${{ matrix.compiler }}
path: .
- name: Download .conan2/p dir
uses: actions/download-artifact@v4
with:
name: conan2-${{ matrix.os }}-${{ matrix.compiler }}
path: ~/.conan2/p
- name: fix artifact permissions
if: runner.os != 'Windows'
run: chmod +x build/test/odr_test
- name: test
if: runner.os != 'Windows'
working-directory: build/test
run: ./odr_test
- name: fix artifact permissions
if: runner.os == 'Windows'
run: chmod +x build/test/Release/odr_test.exe
- name: test
if: runner.os == 'Windows'
working-directory: build/test
run: ./Release/odr_test.exe
- name: tidy public test outputs
run: python3 -u test/scripts/tidy_output.py build/test/output/odr-public/output
- name: compare public test outputs
run: |
python3 -u test/scripts/compare_output.py \
--driver firefox \
--max-workers 1 \
test/data/reference-output/odr-public/output \
build/test/output/odr-public/output
- name: tidy private test outputs
run: python3 -u test/scripts/tidy_output.py build/test/output/odr-private/output
- name: compare private test outputs
run: |
python3 -u test/scripts/compare_output.py \
--driver firefox \
--max-workers 1 \
test/data/reference-output/odr-private/output \
build/test/output/odr-private/output
- name: tidy pdf2htmlEX test outputs
if: runner.os == 'Linux'
run: |
python3 -u test/scripts/tidy_output.py build/test/output/odr-public/output-pdf2htmlEX
python3 -u test/scripts/tidy_output.py build/test/output/odr-private/output-pdf2htmlEX
- name: Compare pdf2htmlEX public test results
if: runner.os == 'Linux'
run: |
python3 -u test/scripts/compare_output.py \
--driver firefox \
--max-workers 1 \
test/data/reference-output/odr-public/output-pdf2htmlEX \
build/test/output/odr-public/output-pdf2htmlEX
- name: Compare pdf2htmlEX private test results
if: runner.os == 'Linux'
run: |
python3 -u test/scripts/compare_output.py \
--driver firefox \
--max-workers 1 \
test/data/reference-output/odr-public/output-pdf2htmlEX \
build/test/output/odr-public/output-pdf2htmlEX
# wvWare has no private test data
- name: tidy wvWare test outputs
if: runner.os == 'Linux'
run: |
python3 -u test/scripts/tidy_output.py build/test/output/odr-public/output-wvWare
- name: Compare wvWare public test results
if: runner.os == 'Linux'
run: |
python3 -u test/scripts/compare_output.py \
--driver firefox \
--max-workers 1 \
test/data/reference-output/odr-public/output-wvWare \
build/test/output/odr-public/output-wvWare
build-test-downstream:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-24.04, compiler: clang-18 }
- { os: ubuntu-24.04, compiler: gcc-14 }
- { os: macos-13, compiler: clang-14 }
- { os: macos-14, compiler: armv8-clang-14 }
- { os: windows-2022, compiler: msvc-1940 }
steps:
- name: checkout
uses: actions/checkout@v4
- name: ubuntu install ccache
if: runner.os == 'Linux'
run: |
sudo apt install ccache
ccache -V
- name: macos install ccache
if: runner.os == 'macOS'
run: |
brew install ccache
ccache -V
- name: set up python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install python dependencies
run: pip install conan
- name: conan remote
run: conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
- name: conan config
run: conan config install .github/config/${{ matrix.os }}-${{ matrix.compiler }}/conan
- name: conan odrcore
run: conan export . --name odrcore --version 0.0.0
- name: conan install
run: conan install . --output-folder=build --build=never
# odrcore/0.0.0 will be missing, can't build=never
- name: conan downstream
run: conan install test/downstream --output-folder=test/downstream/build --build=missing
- name: cmake
run: >
cmake -S test/downstream -B test/downstream/build
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
-DCMAKE_BUILD_TYPE=Release
- name: build
run: cmake --build test/downstream/build --config Release
- name: run
if: runner.os != 'Windows'
run: test/downstream/build/odr-test-downstream
- name: run
if: runner.os == 'Windows'
run: test/downstream/build/Release/odr-test-downstream.exe