Debian Codegraph @

.github/workflows/build.yml

raw symbols SCIP
1 name: Build
2 on: [push, pull_request]
3 concurrency:
4 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
5 cancel-in-progress: true
6 jobs:
7 ci:
8 name: ${{ matrix.name }}
9 runs-on: ${{ matrix.os }}
10 strategy:
11 fail-fast: false
12 matrix:
13 include:
14 - name: Ubuntu GCC ASAN
15 os: ubuntu-latest
16 compiler: gcc
17 cxx-compiler: g++
18 cmake-args: -D MZ_SANITIZER=Address
19 codecov: ubuntu_gcc_asan
20
21 - name: Ubuntu GCC UBSAN
22 os: ubuntu-latest
23 compiler: gcc
24 cxx-compiler: g++
25 cmake-args: -D MZ_SANITIZER=Undefined
26 codecov: ubuntu_gcc_undefined
27
28 - name: Ubuntu GCC MSAN
29 os: ubuntu-latest
30 compiler: gcc
31 cxx-compiler: g++
32 cmake-args: -D MZ_SANITIZER=Memory
33 codecov: ubuntu_gcc_msan
34
35 # No code coverage on release builds
36 - name: Ubuntu 22 Clang
37 os: ubuntu-22.04
38 compiler: clang
39 cxx-compiler: clang++
40 deploy: true
41 deploy-name: linux
42
43 - name: Ubuntu 22 Clang 11
44 os: ubuntu-22.04
45 compiler: clang-11
46 cxx-compiler: clang++-11
47 version: "11"
48 packages: llvm-11 clang-11
49
50 - name: Ubuntu GCC
51 os: ubuntu-latest
52 compiler: gcc
53 cxx-compiler: g++
54 cmake-args: -D MZ_CODE_COVERAGE=ON
55 codecov: ubuntu_gcc
56
57 - name: Ubuntu GCC OSB
58 os: ubuntu-latest
59 compiler: gcc
60 cxx-compiler: g++
61 build-dir: ../build
62 build-src-dir: ../minizip-ng
63
64 - name: Ubuntu Clang
65 os: ubuntu-latest
66 compiler: clang-14
67 cxx-compiler: clang++-14
68 cmake-args: -D MZ_CODE_COVERAGE=ON
69 codecov: ubuntu_clang
70 packages: clang-14 llvm-14
71 gcov-exec: llvm-cov-14 gcov
72
73 - name: Ubuntu Clang No Zlib
74 os: ubuntu-latest
75 compiler: clang-14
76 cxx-compiler: clang++-14
77 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_ZLIB=OFF
78 codecov: ubuntu_clang_no_zlib
79 packages: clang-14 llvm-14
80 gcov-exec: llvm-cov-14 gcov
81
82 - name: Ubuntu Clang No Bzip2
83 os: ubuntu-latest
84 compiler: clang-14
85 cxx-compiler: clang++-14
86 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_BZIP=OFF
87 codecov: ubuntu_clang_no_bzip2
88 packages: clang-14 llvm-14
89 gcov-exec: llvm-cov-14 gcov
90
91 - name: Ubuntu Clang No LZMA
92 os: ubuntu-latest
93 compiler: clang-14
94 cxx-compiler: clang++-14
95 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_LZMA=OFF
96 codecov: ubuntu_clang_no_lzma
97 packages: clang-14 llvm-14
98 gcov-exec: llvm-cov-14 gcov
99
100 - name: Ubuntu Clang No Zstd
101 os: ubuntu-latest
102 compiler: clang-14
103 cxx-compiler: clang++-14
104 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_ZSTD=OFF
105 codecov: ubuntu_clang_no_zstd
106 packages: clang-14 llvm-14
107 gcov-exec: llvm-cov-14 gcov
108
109 - name: Ubuntu Clang No Pkcrypt
110 os: ubuntu-latest
111 compiler: clang-14
112 cxx-compiler: clang++-14
113 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_PKCRYPT=OFF
114 codecov: ubuntu_clang_no_pkcrypt
115 packages: clang-14 llvm-14
116 gcov-exec: llvm-cov-14 gcov
117
118 - name: Ubuntu Clang No Winzip AES
119 os: ubuntu-latest
120 compiler: clang-14
121 cxx-compiler: clang++-14
122 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_WZAES=OFF
123 codecov: ubuntu_clang_no_winzip_aes
124 packages: clang-14 llvm-14
125 gcov-exec: llvm-cov-14 gcov
126
127 - name: Ubuntu Clang No Encryption
128 os: ubuntu-latest
129 compiler: clang-14
130 cxx-compiler: clang++-14
131 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_PKCRYPT=OFF -D MZ_WZAES=OFF
132 codecov: ubuntu_clang_no_encryption
133 packages: clang-14 llvm-14
134 gcov-exec: llvm-cov-14 gcov
135
136 - name: Ubuntu Clang Compress Only
137 os: ubuntu-latest
138 compiler: clang-14
139 cxx-compiler: clang++-14
140 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_COMPRESS_ONLY=ON
141 codecov: ubuntu_clang_compress_only
142 packages: clang-14 llvm-14
143 gcov-exec: llvm-cov-14 gcov
144
145 - name: Ubuntu Clang Decompress Only
146 os: ubuntu-latest
147 compiler: clang-14
148 cxx-compiler: clang++-14
149 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_DECOMPRESS_ONLY=ON
150 codecov: ubuntu_clang_decompress_only
151 packages: clang-14 llvm-14
152 gcov-exec: llvm-cov-14 gcov
153
154 - name: Ubuntu Clang OpenSSL
155 os: ubuntu-latest
156 compiler: clang-14
157 cxx-compiler: clang++-14
158 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_OPENSSL=ON
159 codecov: ubuntu_clang_openssl
160 packages: clang-14 llvm-14
161 gcov-exec: llvm-cov-14 gcov
162
163 # No code coverage supported
164 - name: Windows MSVC
165 os: windows-latest
166 compiler: cl
167 # Don't use find_package for 3rd party libraries which are installed incorrectly on GitHub CI instances
168 cmake-args: -D MZ_FORCE_FETCH_LIBS=ON
169 deploy: true
170 deploy-name: windows
171
172 # # No code coverage supported
173 # - name: Windows MSVC XP
174 # os: windows-latest
175 # compiler: cl
176 # # Don't use find_package for 3rd party libraries which are installed incorrectly on GitHub CI instances
177 # cmake-args: -D MZ_FORCE_FETCH_LIBS=ON -D CMAKE_C_FLAGS="-D_WIN32_WINNT=0x501" -D CMAKE_CXX_FLAGS="-D_WIN32_WINNT=0x501"
178 # deploy: true
179 # deploy-name: windowsxp
180
181 - name: Windows GCC Code Coverage
182 os: windows-latest
183 compiler: gcc
184 cxx-compiler: g++
185 # Don't use find_package for 3rd party libraries which are installed incorrectly on GitHub CI instances
186 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_FORCE_FETCH_LIBS=ON -G Ninja
187 codecov: windows_gcc
188
189 # No code coverage on release builds
190 - name: macOS Xcode
191 os: macos-latest
192 deploy: true
193 deploy-name: macos
194
195 - name: macOS Xcode Code Coverage
196 os: macOS-latest
197 cmake-args: -D MZ_CODE_COVERAGE=ON
198 codecov: macos_xcode
199
200 - name: macOS Xcode LibCompression
201 os: macOS-latest
202 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_LIBCOMP=ON
203 codecov: macos_xcode_libcompression
204
205 - name: macOS Xcode OpenSSL
206 os: macos-latest
207 cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_OPENSSL=ON
208 codecov: macos_xcode_openssl
209
210 steps:
211 - name: Checkout repository
212 uses: actions/checkout@v4
213
214 - name: Install packages (macOS)
215 if: runner.os == 'macOS'
216 run: brew install pkgconfig ${{ matrix.packages }}
217
218 - name: Install packages (Ubuntu)
219 if: runner.os == 'Linux' && matrix.packages
220 run: |
221 sudo apt-get update
222 sudo apt-get install ${{ matrix.packages }}
223
224 - name: Install packages (Windows)
225 if: runner.os == 'Windows' && matrix.compiler == 'gcc'
226 run: |
227 # strawberryperl installs incompatible libraries so remove it
228 choco uninstall --no-progress strawberryperl
229 choco install ninja --no-progress
230
231 - name: Generate project files
232 shell: bash
233 run: |
234 cmake -S ${{ matrix.build-src-dir || '.' }} -B ${{ matrix.build-dir || '.' }} ${{ matrix.cmake-args }} \
235 -D MZ_BUILD_TESTS=ON \
236 -D MZ_BUILD_UNIT_TESTS=ON \
237 -D BUILD_SHARED_LIBS=OFF \
238 -D CMAKE_BUILD_TYPE=Release
239 env:
240 CC: ${{ matrix.compiler }}
241 CXX: ${{ matrix.cxx-compiler }}
242 CFLAGS: ${{ matrix.cflags }}
243 LDFLAGS: ${{ matrix.ldflags }}
244
245 - name: Compile source code
246 run: cmake --build ${{ matrix.build-dir || '.' }} --config ${{ matrix.build-config || 'Release' }}
247
248 - name: Run test cases
249 run: ctest --output-on-failure -C ${{ matrix.build-config || 'Release' }}
250 working-directory: ${{ matrix.build-dir }}
251
252 - name: Setup python
253 uses: actions/setup-python@v5
254 if: always() && matrix.codecov
255 with:
256 python-version: '3.x'
257
258 - name: Generate coverage report
259 shell: bash
260 if: always() && matrix.codecov
261 run: |
262 python3 -u -m pip install gcovr
263 python3 -m gcovr \
264 --exclude-unreachable-branches \
265 --gcov-ignore-parse-errors \
266 --gcov-executable "${{ matrix.gcov-exec || 'gcov' }}" \
267 --root ${{ matrix.build-src-dir || '.' }} \
268 --xml \
269 --output coverage.xml \
270 --verbose
271
272 - name: Upload coverage report
273 uses: codecov/codecov-action@v5
274 if: always() && matrix.codecov && env.CODECOV_TOKEN != ''
275 with:
276 token: ${{ secrets.CODECOV_TOKEN }}
277 flags: ${{ matrix.codecov }}
278 name: ${{ matrix.name }}
279 directory: ${{ matrix.build-src-dir || '.' }}
280 verbose: true
281 fail_ci_if_error: true
282 env:
283 CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
284
285 - name: Package release (Ubuntu/macOS)
286 if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.deploy && startsWith(github.ref, 'refs/tags/')
287 run: ls -R mini*zip | tar -czvf minizip-ng-${{ matrix.deploy-name }}.tar.gz -T -
288
289 - name: Upload release (Ubuntu/macOS)
290 uses: svenstaro/[email protected]
291 if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.deploy && startsWith(github.ref, 'refs/tags/') && env.GITHUB_TOKEN != ''
292 with:
293 asset_name: minizip-ng-${{ matrix.deploy-name }}.tar.gz
294 file: ${{ matrix.build-dir || '.' }}/minizip-ng-${{ matrix.deploy-name }}.tar.gz
295 tag: ${{ github.ref }}
296 repo_token: ${{ secrets.GITHUB_TOKEN }}
297 overwrite: true
298 env:
299 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
300
301 - name: Package release (Windows)
302 if: runner.os == 'Windows' && matrix.deploy && startsWith(github.ref, 'refs/tags/')
303 run: 7z a -tzip minizip-ng-${{ matrix.deploy-name }}.zip ./Release/mini*zip.exe
304
305 - name: Upload release (Windows)
306 uses: svenstaro/[email protected]
307 if: runner.os == 'Windows' && matrix.deploy && startsWith(github.ref, 'refs/tags/') && env.GITHUB_TOKEN != ''
308 with:
309 asset_name: minizip-ng-${{ matrix.deploy-name }}.zip
310 file: ${{ matrix.build-dir || '.' }}/minizip-ng-${{ matrix.deploy-name }}.zip
311 tag: ${{ github.ref }}
312 repo_token: ${{ secrets.GITHUB_TOKEN }}
313 overwrite: true
314 env:
315 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"