forked from zxing-cpp/zxing-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (182 loc) · 6.69 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
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:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Setup Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
working-directory: ${{runner.workspace}}/build
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_BLACKBOX_TESTS=ON -DBUILD_UNIT_TESTS=ON -DBUILD_PYTHON_MODULE=ON -DBUILD_C_API=ON
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . -j8 --config $BUILD_TYPE
- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -V -C $BUILD_TYPE
build-ubuntu-sanitize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.ref}}
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure
run: >
cmake -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build -DCMAKE_BUILD_TYPE=RelWithDebInfo
-DBUILD_BLACKBOX_TESTS=ON -DBUILD_UNIT_TESTS=ON -DBUILD_PYTHON_MODULE=OFF -DBUILD_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"
- name: Build
run: cmake --build ${{runner.workspace}}/build -j8
- name: Test
working-directory: ${{runner.workspace}}/build
run: ctest -V
build-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.ref}}
- name: Build the swift package
shell: sh
working-directory: ${{runner.workspace}}/${{github.event.repository.name}}
run: swift build
- name: Build the demo app
shell: sh
working-directory: ${{runner.workspace}}/${{github.event.repository.name}}/wrappers/ios/demo
run: xcodebuild build -scheme demo -sdk "iphonesimulator"
- name: Validate the Pod
shell: sh
working-directory: ${{runner.workspace}}/${{github.event.repository.name}}
run: pod lib lint --allow-warnings
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build the lib/app
working-directory: wrappers/android
run: ./gradlew assembleDebug # build only the debug version of the aar (faster build)
- uses: actions/upload-artifact@v3
with:
name: android-artifacts
path: "wrappers/android/zxingcpp/build/outputs/aar/zxingcpp-debug.aar"
build-python:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: wrappers/python
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
build-rust:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Lint
working-directory: wrappers/rust
run: |
cargo fmt --check
cargo clippy -- -Dwarnings
- name: Build
working-directory: wrappers/rust
run: cargo build --release --verbose --features bundled,image --examples
- name: Test
working-directory: wrappers/rust
run: cargo test --release --features bundled,image
- name: Package
working-directory: wrappers/rust
# --allow-dirty is required on the windows build (but not the ubuntu build?!)
run: cargo package --verbose --allow-dirty --features bundled,image
build-wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v12
- name: Configure
run: emcmake cmake -Swrappers/wasm -Bbuild
- name: Build
run: cmake --build build -j4
# - name: Test
# run: node build/EmGlueTests.js
- uses: actions/upload-artifact@v3
with:
name: wasm-artifacts
path: |
build/zxing*
build/demo*
build-winrt:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
shell: cmd
run: >
cmake -S ${{github.workspace}}/wrappers/winrt -B ${{runner.workspace}}/build -A ARM64
-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_BUILD_TYPE=Release
-DBUILD_WINRT_LIB=ON -DBUILD_EXAMPLES=OFF -DBUILD_BLACKBOX_TESTS=OFF
-DEXTENSION_SDK_OUTPUT=dist/UAP/v0.8.0.0/ExtensionSDKs/ZXingWinRT/1.0.0.0
- name: Build
shell: cmd
run: cmake --build ${{runner.workspace}}/build -j8 --config Release
- uses: actions/upload-artifact@v3
with:
name: winrt-ARM64-artifacts
path: ${{runner.workspace}}/build/dist