-
-
Notifications
You must be signed in to change notification settings - Fork 436
320 lines (281 loc) · 11.6 KB
/
build.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
name: Build
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
ci:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# - name: Ubuntu 20 GCC
# os: ubuntu-20.04
# compiler: gcc
# cxx-compiler: g++
# - name: Ubuntu GCC ASAN
# os: ubuntu-latest
# compiler: gcc
# cxx-compiler: g++
# cmake-args: -D MZ_SANITIZER=Address
# codecov: ubuntu_gcc_asan
# - name: Ubuntu GCC UBSAN
# os: ubuntu-latest
# compiler: gcc
# cxx-compiler: g++
# cmake-args: -D MZ_SANITIZER=Undefined
# codecov: ubuntu_gcc_undefined
# - name: Ubuntu GCC MSAN
# os: ubuntu-latest
# compiler: gcc
# cxx-compiler: g++
# cmake-args: -D MZ_SANITIZER=Memory
# codecov: ubuntu_gcc_msan
# # No code coverage on release builds
# - name: Ubuntu 20 Clang
# os: ubuntu-20.04
# compiler: clang
# cxx-compiler: clang++
# deploy: true
# deploy-name: linux
# - name: Ubuntu 20 Clang 6.0
# os: ubuntu-20.04
# compiler: clang-6.0
# cxx-compiler: clang++-6.0
# version: "6.0"
# packages: llvm-6.0 clang-6.0
# - name: Ubuntu GCC
# os: ubuntu-latest
# compiler: gcc
# cxx-compiler: g++
# cmake-args: -D MZ_CODE_COVERAGE=ON
# codecov: ubuntu_gcc
# - name: Ubuntu GCC OSB
# os: ubuntu-latest
# compiler: gcc
# cxx-compiler: g++
# build-dir: ../build
# build-src-dir: ../minizip-ng
# - name: Ubuntu Clang
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON
# codecov: ubuntu_clang
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang No Zlib
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_ZLIB=OFF
# codecov: ubuntu_clang_no_zlib
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang No Bzip2
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_BZIP=OFF
# codecov: ubuntu_clang_no_bzip2
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang No LZMA
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_LZMA=OFF
# codecov: ubuntu_clang_no_lzma
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang No Zstd
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_ZSTD=OFF
# codecov: ubuntu_clang_no_zstd
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang No Pkcrypt
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_PKCRYPT=OFF
# codecov: ubuntu_clang_no_pkcrypt
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang No Winzip AES
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_WZAES=OFF
# codecov: ubuntu_clang_no_winzip_aes
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang No Encryption
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_PKCRYPT=OFF -D MZ_WZAES=OFF
# codecov: ubuntu_clang_no_encryption
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang Compress Only
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_COMPRESS_ONLY=ON
# codecov: ubuntu_clang_compress_only
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang Decompress Only
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_DECOMPRESS_ONLY=ON
# codecov: ubuntu_clang_decompress_only
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# - name: Ubuntu Clang OpenSSL
# os: ubuntu-latest
# compiler: clang-14
# cxx-compiler: clang++-14
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_OPENSSL=ON
# codecov: ubuntu_clang_openssl
# packages: clang-14 llvm-14
# gcov-exec: llvm-cov-14 gcov
# # No code coverage supported
# - name: Windows MSVC
# os: windows-latest
# compiler: cl
# # Don't use find_package for 3rd party libraries which are installed incorrectly on GitHub CI instances
# cmake-args: -D MZ_FORCE_FETCH_LIBS=ON
# deploy: true
# deploy-name: windows
# # # No code coverage supported
# # - name: Windows MSVC XP
# # os: windows-latest
# # compiler: cl
# # # Don't use find_package for 3rd party libraries which are installed incorrectly on GitHub CI instances
# # cmake-args: -D MZ_FORCE_FETCH_LIBS=ON -D CMAKE_C_FLAGS="-D_WIN32_WINNT=0x501" -D CMAKE_CXX_FLAGS="-D_WIN32_WINNT=0x501"
# # deploy: true
# # deploy-name: windowsxp
# - name: Windows GCC Code Coverage
# os: windows-latest
# compiler: gcc
# cxx-compiler: g++
# # Don't use find_package for 3rd party libraries which are installed incorrectly on GitHub CI instances
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_FORCE_FETCH_LIBS=ON -G Ninja
# codecov: windows_gcc
# # No code coverage on release builds
# - name: macOS Xcode
# os: macos-latest
# deploy: true
# deploy-name: macos
# - name: macOS Xcode Code Coverage
# os: macOS-latest
# cmake-args: -D MZ_CODE_COVERAGE=ON
# codecov: macos_xcode
# - name: macOS Xcode LibCompression
# os: macOS-latest
# cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_LIBCOMP=ON
# codecov: macos_xcode_libcompression
- name: macOS Xcode OpenSSL
os: macos-latest
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_OPENSSL=ON -D OPENSSL_ROOT_DIR=/usr/local/opt/openssl -D OPENSSL_INCLUDE_DIRS=/usr/local/opt/openssl/include -D OPENSSL_CRYPTO_LIBRARY=/usr/local/opt/openssl/lib/libcrypto.dylib -D OPENSSL_SSL_LIBRARY=/usr/local/opt/openssl/lib/libssl.dylib
codecov: macos_xcode_openssl
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install packages (macOS)
if: runner.os == 'macOS'
run: brew install pkgconfig ${{ matrix.packages }} tree
- name: Install packages (Ubuntu)
if: runner.os == 'Linux' && matrix.packages
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.packages }}
- name: Install packages (Windows)
if: runner.os == 'Windows' && matrix.compiler == 'gcc'
run: |
# strawberryperl installs incompatible libraries so remove it
choco uninstall --no-progress strawberryperl
choco install ninja --no-progress
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Generate project files
shell: bash
run: |
tree /usr/local/opt/openssl
cmake -S ${{ matrix.build-src-dir || '.' }} -B ${{ matrix.build-dir || '.' }} ${{ matrix.cmake-args }} \
-D MZ_BUILD_TESTS=ON \
-D MZ_BUILD_UNIT_TESTS=ON \
-D BUILD_SHARED_LIBS=OFF \
-D CMAKE_BUILD_TYPE=Release
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.cxx-compiler }}
CFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.ldflags }}
- name: Compile source code
run: cmake --build ${{ matrix.build-dir || '.' }} --config ${{ matrix.build-config || 'Release' }}
- name: Run test cases
run: ctest --output-on-failure -C ${{ matrix.build-config || 'Release' }}
working-directory: ${{ matrix.build-dir }}
- name: Generate coverage report
shell: bash
if: always() && matrix.codecov
run: |
python3 -u -m pip install gcovr
python3 -m gcovr \
--exclude-unreachable-branches \
--gcov-ignore-parse-errors \
--gcov-executable "${{ matrix.gcov-exec || 'gcov' }}" \
--root ${{ matrix.build-src-dir || '.' }} \
--xml \
--output coverage.xml \
--verbose
- name: Upload coverage report
uses: codecov/codecov-action@v4
if: always() && matrix.codecov && env.CODECOV_TOKEN != ''
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.codecov }}
name: ${{ matrix.name }}
directory: ${{ matrix.build-src-dir || '.' }}
verbose: true
fail_ci_if_error: true
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
- name: Package release (Ubuntu/macOS)
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.deploy && startsWith(github.ref, 'refs/tags/')
run: ls -R mini*zip | tar -czvf minizip-ng-${{ matrix.deploy-name }}.tar.gz -T -
- name: Upload release (Ubuntu/macOS)
uses: svenstaro/[email protected]
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.deploy && startsWith(github.ref, 'refs/tags/') && env.GITHUB_TOKEN != ''
with:
asset_name: minizip-ng-${{ matrix.deploy-name }}.tar.gz
file: ${{ matrix.build-dir || '.' }}/minizip-ng-${{ matrix.deploy-name }}.tar.gz
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Package release (Windows)
if: runner.os == 'Windows' && matrix.deploy && startsWith(github.ref, 'refs/tags/')
run: 7z a -tzip minizip-ng-${{ matrix.deploy-name }}.zip ./Release/mini*zip.exe
- name: Upload release (Windows)
uses: svenstaro/[email protected]
if: runner.os == 'Windows' && matrix.deploy && startsWith(github.ref, 'refs/tags/') && env.GITHUB_TOKEN != ''
with:
asset_name: minizip-ng-${{ matrix.deploy-name }}.zip
file: ${{ matrix.build-dir || '.' }}/minizip-ng-${{ matrix.deploy-name }}.zip
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"