forked from zxing-cpp/zxing-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
424 lines (342 loc) · 12.3 KB
/
ci.yml
File metadata and controls
424 lines (342 loc) · 12.3 KB
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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
# don't cancel all jobs just because one of them failed
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Setup Python 3
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Configure
run: >
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SHARED_LIBS=ON
-DZXING_BLACKBOX_TESTS=ON -DZXING_TEST_DOTNET=ON -DZXING_TEST_GO=ON -DZXING_TEST_INSTALL=ON -DZXING_UNIT_TESTS=ON
-DZXING_PYTHON_MODULE=ON
- name: Build
run: cmake --build build --parallel --config ${{env.BUILD_TYPE}}
- name: Set PATH for Tests
shell: bash # to make the $GITHUB_PATH update work
if: runner.os == 'Windows'
run: |
echo "${GITHUB_WORKSPACE}/build/core/${BUILD_TYPE}" >> $GITHUB_PATH
echo "${GITHUB_WORKSPACE}/build/bin/${BUILD_TYPE}" >> $GITHUB_PATH
cp "${GITHUB_WORKSPACE}/build/core/Release/ZXing.dll" "${GITHUB_WORKSPACE}/build/wrappers/python/Release/"
- name: Test
run: ctest --test-dir build -V -C ${{env.BUILD_TYPE}}
- name: Install
run: |
cmake -E make_directory install
cmake --install build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install
- uses: actions/upload-artifact@v6
with:
name: ${{matrix.os}}-artifacts
path: install
build-exp:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, ubuntu-24.04-arm, macos-15-intel] # windows-11-arm,
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Configure
run: >
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SHARED_LIBS=ON
-DZXING_READERS=ON -DZXING_WRITERS=BOTH -DZXING_EXPERIMENTAL_API=ON
-DZXING_BLACKBOX_TESTS=ON -DZXING_TEST_INSTALL=ON -DZXING_UNIT_TESTS=OFF -DZXING_PYTHON_MODULE=ON
- name: Build
run: cmake --build build --parallel --config ${{env.BUILD_TYPE}}
- name: Set PATH for Tests
shell: bash # to make the $GITHUB_PATH update work
if: runner.os == 'Windows'
run: |
echo "${GITHUB_WORKSPACE}/build/core/${BUILD_TYPE}" >> $GITHUB_PATH
echo "${GITHUB_WORKSPACE}/build/bin/${BUILD_TYPE}" >> $GITHUB_PATH
cp "${GITHUB_WORKSPACE}/build/core/Release/ZXing.dll" "${GITHUB_WORKSPACE}/build/wrappers/python/Release/"
- name: Test
run: ctest --test-dir build -V -C ${{env.BUILD_TYPE}}
- name: Install
run: |
cmake -E make_directory install
cmake --install build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install
- uses: actions/upload-artifact@v6
with:
name: ${{matrix.os}}-exp-artifacts
path: install
build-ubuntu-gcc-12: # keep homebrew happy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Configure
run: >
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
-DZXING_WRITERS=BOTH
-DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_COMPILER=gcc-12
- name: Build
run: cmake --build build --parallel
- name: Test
run: ctest -V --test-dir build
build-ubuntu-asan-ubsan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Configure
run: >
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DZXING_WRITERS=BOTH
-DZXING_BLACKBOX_TESTS=ON -DZXING_UNIT_TESTS=ON -DZXING_PYTHON_MODULE=OFF -DZXING_C_API=OFF
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_FLAGS="-march=native -fsanitize=address,undefined -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer"
-DCMAKE_C_COMPILER=clang
-DCMAKE_C_FLAGS="-march=native -fsanitize=address,undefined -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer"
- name: Build
run: cmake --build build --parallel
- name: Test
run: ctest -V --test-dir build
build-ubuntu-tsan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Configure
run: >
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DZXING_WRITERS=OFF -DZXING_EXAMPLES=OFF
-DZXING_BLACKBOX_TESTS=ON -DZXING_UNIT_TESTS=OFF -DZXING_PYTHON_MODULE=OFF -DZXING_C_API=OFF
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_FLAGS="-march=native -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer -g"
-DCMAKE_C_COMPILER=clang
-DCMAKE_C_FLAGS="-march=native -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer -g"
- name: Build
run: cmake --build build --parallel
- name: Test
run: ctest -V --test-dir build
build-old-writers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Configure
run: >
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
-DZXING_READERS=ON -DZXING_WRITERS=OLD -DZXING_PYTHON_MODULE=ON -DZXING_C_API=ON
-DZXING_BLACKBOX_TESTS=ON -DZXING_TEST_INSTALL=ON -DZXING_UNIT_TESTS=ON -DZXING_PYTHON_MODULE=ON
- name: Build
run: cmake --build build --parallel
- name: Test
run: ctest -V --test-dir build
build-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Build the swift package
run: swift build
- name: Build the demo app
working-directory: wrappers/ios/demo
run: xcodebuild build -scheme demo -sdk "iphonesimulator"
- name: Validate the Pod
run: pod lib lint --allow-warnings
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
- name: Build the lib/app
working-directory: wrappers/android
run: ./gradlew assembleRelease
- uses: actions/upload-artifact@v6
with:
name: android-artifacts
path: "wrappers/android/zxingcpp/build/outputs/aar/zxingcpp-release.aar"
- name: Publish Library Snapshot
if: github.repository == 'zxing-cpp/zxing-cpp' && github.event_name != 'pull_request'
working-directory: wrappers/android
env:
ORG_GRADLE_PROJECT_publishSnapshot: true
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }}
run: ./gradlew publishToMavenCentral --no-configuration-cache
build-kn:
runs-on: ubuntu-latest
defaults:
run:
working-directory: wrappers/kn
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: true
- name: Prepare Zig toolchain
uses: mlugg/setup-zig@v2
with:
version: 0.13.0
- name: Checkout toolchain initializer repository
uses: actions/checkout@v6
with:
repository: ISNing/kn-toolchain-initializer
path: wrappers/kn/.kn-toolchain-initializer
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: 17
distribution: temurin
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v5
- name: Initialize Kotlin/Native toolchain
working-directory: wrappers/kn/.kn-toolchain-initializer
run: ./gradlew build -DkotlinVersion=2.2.0
- name: Run test for linuxX64 target
run: |
echo -e "konan.dir=$HOME/.konan/kotlin-native-prebuilt-linux-x86_64-2.2.0" >> local.properties
./gradlew linuxX64Test
build-python:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install numpy pillow
- name: Build module
working-directory: wrappers/python
run: python -m pip -v install -e .
- name: Test module
working-directory: wrappers/python
run: python -m unittest -v
- uses: actions/upload-artifact@v6
with:
name: ${{matrix.os}}-python-artifacts
path: wrappers/python/zxingcpp.*
build-rust:
runs-on: ubuntu-latest
defaults:
run:
working-directory: wrappers/rust
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Lint
run: |
cargo fmt --check
cargo clippy -- -Dwarnings
- name: Build
run: cargo build --release --verbose --all-features --examples
- name: Test
run: cargo test --release --all-features
- name: Package
# --allow-dirty is required on the windows build (but not the ubuntu build?!)
run: |
cargo package --all-features
cargo publish --dry-run
- uses: actions/upload-artifact@v6
with:
name: rust-artifacts
path: wrappers/rust/target/package/*.crate
build-wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: emscripten-core/setup-emsdk@v15
- name: Configure
run: emcmake cmake -Swrappers/wasm -Bbuild
- name: Build
run: cmake --build build --parallel
# - name: Test
# run: node build/EmGlueTests.js
- uses: actions/upload-artifact@v6
with:
name: wasm-artifacts
path: |
build/zxing*
build/demo*
# disable WinRT build for now, as it does not compile with C++20 (see wrappers/winrt/CMakeLists.txt)
# build-winrt:
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v6
# with:
# submodules: true
# - name: Configure
# shell: cmd # powershell messes up the arguments containing a '.' ?!?
# run: >
# cmake -S wrappers/winrt -B build -A ARM64
# -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_BUILD_TYPE=Release
# -DBUILD_WINRT_LIB=ON -DZXING_EXAMPLES=OFF -DZXING_BLACKBOX_TESTS=OFF -DZXING_C_API=OFF
# -DEXTENSION_SDK_OUTPUT=dist/UAP/v0.8.0.0/ExtensionSDKs/ZXingWinRT/1.0.0.0
# - name: Build
# run: cmake --build build -j8 --config Release
# - uses: actions/upload-artifact@v6
# with:
# name: winrt-ARM64-artifacts
# path: build/dist
build-tarball:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Build
run: python .github/create_release_archive.py
- name: Find generated archives
id: find
run: |
tgz=$(ls zxing-cpp-*.tar.gz 2>/dev/null | head -n1 || true)
zip=$(ls zxing-cpp-*.zip 2>/dev/null | head -n1 || true)
echo "tgz=$tgz" >> $GITHUB_OUTPUT
echo "zip=$zip" >> $GITHUB_OUTPUT
- name: Upload source_artifacts
uses: actions/upload-artifact@v6
with:
name: source_artifacts
path: |
${{ steps.find.outputs.tgz }}
${{ steps.find.outputs.zip }}