forked from libssh2/libssh2
-
Notifications
You must be signed in to change notification settings - Fork 1
353 lines (335 loc) · 13.7 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
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
# Copyright (C) The libssh2 project and its contributors.
#
# SPDX-License-Identifier: BSD-3-Clause
#
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions: {}
jobs:
check_style:
name: 'style-check'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: 'checksrc'
run: ./ci/checksrc.sh
build_linux:
name: 'linux'
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
arch: [amd64]
crypto: [OpenSSL, wolfSSL, Libgcrypt, mbedTLS]
build: [cmake]
zlib: ['OFF', 'ON']
include:
- compiler: gcc
arch: amd64
crypto: OpenSSL
build: autotools
zlib: 'OFF'
- compiler: clang
arch: amd64
crypto: OpenSSL
build: autotools
zlib: 'OFF'
- compiler: clang
arch: amd64
crypto: OpenSSL
build: autotools
zlib: 'ON'
target: 'distcheck'
- compiler: gcc
arch: i386
crypto: mbedTLS
build: cmake
zlib: 'ON'
- compiler: clang
arch: i386
crypto: Libgcrypt
build: autotools
zlib: 'ON'
options: --disable-static
env:
CC: ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v3
- name: 'install architecture'
if: ${{ matrix.arch != 'amd64' }}
run: |
sudo dpkg --add-architecture '${{ matrix.arch }}'
sudo apt-get --quiet 2 --option Dpkg::Use-Pty=0 update
# Workaround for https://github.com/actions/runner-images/issues/7589
sudo apt-get --quiet 2 --option Dpkg::Use-Pty=0 install libgcc-s1:${{ matrix.arch }}
sudo apt-get --quiet 2 --option Dpkg::Use-Pty=0 install gcc-multilib build-essential zlib1g-dev:${{ matrix.arch }}
- name: 'install packages'
if: ${{ matrix.crypto != 'mbedTLS' }}
run: |
[ '${{ matrix.crypto }}' = 'OpenSSL' ] && pkg='libssl-dev'
[ '${{ matrix.crypto }}' = 'wolfSSL' ] && pkg='libwolfssl-dev'
[ '${{ matrix.crypto }}' = 'Libgcrypt' ] && pkg='libgcrypt-dev'
sudo apt-get --quiet 2 --option Dpkg::Use-Pty=0 install "${pkg}:${{ matrix.arch }}"
- name: 'install mbedTLS from source'
if: ${{ matrix.crypto == 'mbedTLS' }}
run: |
MBEDTLSVER=mbedtls-3.4.0
curl -L https://github.com/Mbed-TLS/mbedtls/archive/$MBEDTLSVER.tar.gz | tar -xzf -
cd mbedtls-$MBEDTLSVER
[ '${{ matrix.arch }}' = 'i386' ] && crossoptions='-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DCMAKE_C_FLAGS=-m32'
cmake . ${crossoptions} \
-DUSE_SHARED_MBEDTLS_LIBRARY=ON \
-DCMAKE_INSTALL_PREFIX:PATH=../usr
make -j3 install
cd ..
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/usr/lib" >> $GITHUB_ENV
echo "TOOLCHAIN_OPTION=$TOOLCHAIN_OPTION -DCMAKE_PREFIX_PATH=$PWD/usr" >> $GITHUB_ENV
- name: 'autotools autoreconf'
if: ${{ matrix.build == 'autotools' }}
run: autoreconf -fi
- name: 'autotools configure'
if: ${{ matrix.build == 'autotools' }}
run: |
if [ '${{ matrix.arch }}' = 'i386' ]; then
crossoptions='--host=i686-pc-linux-gnu'
export CFLAGS=-m32
fi
mkdir bld && cd bld && ../configure --enable-werror --enable-debug \
${crossoptions} ${{ matrix.options }}
- name: 'autotools build'
if: ${{ matrix.build == 'autotools' && !matrix.target }}
run: make -C bld -j3
- name: 'autotools tests'
if: ${{ matrix.build == 'autotools' && !matrix.target }}
timeout-minutes: 10
run: make -C bld check VERBOSE=1
- name: 'autotools distcheck'
if: ${{ matrix.target == 'distcheck' }}
run: make -C bld -j3 distcheck
- name: 'cmake configure'
if: ${{ matrix.build == 'cmake' }}
run: |
[ '${{ matrix.arch }}' = 'i386' ] && crossoptions='-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DCMAKE_C_FLAGS=-m32'
cmake . -B bld ${crossoptions} $TOOLCHAIN_OPTION \
-DENABLE_WERROR=ON \
-DCRYPTO_BACKEND=${{ matrix.crypto }} \
-DENABLE_ZLIB_COMPRESSION=${{ matrix.zlib }}
- name: 'cmake build'
if: ${{ matrix.build == 'cmake' }}
run: cmake --build bld --parallel 3 --target package
- name: 'cmake tests'
if: ${{ matrix.build == 'cmake' && matrix.crypto != 'wolfSSL' }}
timeout-minutes: 10
run: |
export OPENSSH_SERVER_IMAGE=ghcr.io/libssh2/ci_tests_openssh_server:$(git rev-parse --short=20 HEAD:tests/openssh_server)
cd bld && ctest -VV --output-on-failure
build_msys2:
name: 'msys2'
runs-on: windows-latest
timeout-minutes: 30
strategy:
matrix:
include:
- { build: 'autotools', sys: mingw64, env: x86_64 }
- { build: 'autotools', sys: mingw32, env: i686 }
- { build: 'autotools', sys: ucrt64, env: ucrt-x86_64 }
- { build: 'autotools', sys: clang64, env: clang-x86_64 }
- { build: 'cmake' , sys: ucrt64, env: ucrt-x86_64 }
- { build: 'cmake' , sys: clang64, env: clang-x86_64 }
- { build: 'make' , sys: mingw64, env: x86_64 }
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
install: >-
mingw-w64-${{ matrix.env }}-cc
mingw-w64-${{ matrix.env }}-${{ matrix.build }} make
mingw-w64-${{ matrix.env }}-openssl
- name: 'autotools autoreconf'
if: ${{ matrix.build == 'autotools' }}
shell: msys2 {0}
run: autoreconf -fi
- name: 'autotools configure'
if: ${{ matrix.build == 'autotools' }}
env:
SSHD: 'C:/Program Files/Git/usr/bin/sshd.exe'
shell: msys2 {0}
run: |
# sshd tests sometimes hang
mkdir bld && cd bld && ../configure --enable-werror --enable-debug \
--with-crypto=openssl \
--disable-docker-tests \
--disable-sshd-tests
- name: 'autotools build'
if: ${{ matrix.build == 'autotools' }}
shell: msys2 {0}
run: make -C bld -j3
- name: 'autotools tests'
if: ${{ matrix.build == 'autotools' }}
timeout-minutes: 10
shell: msys2 {0}
run: make -C bld check VERBOSE=1
- name: 'cmake configure'
if: ${{ matrix.build == 'cmake' }}
env:
CMAKE_GENERATOR: 'MSYS Makefiles'
shell: msys2 {0}
run: |
if [[ '${{ matrix.env }}' = 'clang'* ]]; then
options='-DCMAKE_C_COMPILER=clang -DCMAKE_UNITY_BUILD=ON'
else
options='-DCMAKE_C_COMPILER=gcc'
fi
cmake . -B bld ${options} \
-DENABLE_WERROR=ON \
-DENABLE_DEBUG_LOGGING=ON \
-DCRYPTO_BACKEND=OpenSSL \
-DENABLE_ZLIB_COMPRESSION=ON \
-DRUN_DOCKER_TESTS=OFF \
-DRUN_SSHD_TESTS=OFF
- name: 'cmake build'
if: ${{ matrix.build == 'cmake' }}
shell: msys2 {0}
run: cmake --build bld --parallel 3
- name: 'cmake tests'
if: ${{ matrix.build == 'cmake' }}
timeout-minutes: 10
shell: msys2 {0}
run: cd bld && ctest -VV --output-on-failure
- name: 'make build'
if: ${{ matrix.build == 'make' }}
env:
CPPFLAGS: -DLIBSSH2_NO_MD5 -DLIBSSH2_NO_HMAC_RIPEMD -DLIBSSH2_NO_DSA -DLIBSSH2_NO_AES_CBC -DLIBSSH2_NO_AES_CTR -DLIBSSH2_NO_BLOWFISH -DLIBSSH2_NO_RC4 -DLIBSSH2_NO_CAST -DLIBSSH2_NO_3DES
LIBSSH2_CPPFLAGS_LIB: -DLIBSSH2_EXPORTS
ZLIB_PATH: /${{ matrix.sys }}
OPENSSL_PATH: /${{ matrix.sys }}
shell: msys2 {0}
run: mkdir bld && cd bld && BLD_DIR=bld make -C .. -j3 -f Makefile.mk dyn example test
build_msvc:
name: 'msvc'
runs-on: windows-latest
timeout-minutes: 30
strategy:
matrix:
include:
- { arch: x64 , plat: windows, crypto: WinCNG , log: 'OFF', shared: 'OFF', zlib: 'OFF', unity: 'OFF' }
- { arch: x64 , plat: windows, crypto: WinCNG , log: 'ON' , shared: 'ON' , zlib: 'OFF', unity: 'OFF' }
- { arch: x64 , plat: windows, crypto: OpenSSL, log: 'OFF', shared: 'ON' , zlib: 'OFF', unity: 'OFF' }
- { arch: x64 , plat: uwp , crypto: WinCNG , log: 'OFF', shared: 'ON' , zlib: 'OFF', unity: 'OFF' }
- { arch: arm64, plat: windows, crypto: WinCNG , log: 'OFF', shared: 'ON' , zlib: 'OFF', unity: 'OFF' }
- { arch: arm64, plat: uwp , crypto: WinCNG , log: 'OFF', shared: 'ON' , zlib: 'OFF', unity: 'ON' }
- { arch: x86 , plat: windows, crypto: WinCNG , log: 'OFF', shared: 'ON' , zlib: 'OFF', unity: 'OFF' }
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: 'cmake configure'
shell: bash
run: |
archgen=${{ matrix.arch }}; [ "${archgen}" = 'x86' ] && archgen='Win32'
if [ '${{ matrix.plat }}' = 'uwp' ]; then
system='WindowsStore'
options='-DCMAKE_SYSTEM_VERSION=10.0'
else
system='Windows'
fi
cmake . -B bld ${options} \
-DCMAKE_SYSTEM_NAME=${system} \
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_GENERATOR_PLATFORM=${archgen} \
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-${{ matrix.plat }} \
-DCMAKE_VS_GLOBALS=TrackFileAccess=false \
-DCMAKE_UNITY_BUILD=${{ matrix.unity }} \
-DENABLE_WERROR=ON \
-DENABLE_DEBUG_LOGGING=${{ matrix.log }} \
-DBUILD_SHARED_LIBS=${{ matrix.shared }} \
-DCRYPTO_BACKEND=${{ matrix.crypto }} \
-DENABLE_ZLIB_COMPRESSION=${{ matrix.zlib }} \
-DRUN_DOCKER_TESTS=OFF \
-DRUN_SSHD_TESTS=OFF
- name: 'cmake build'
run: cmake --build bld --parallel 3 --target package --config Release
- name: 'cmake tests'
# UWP binaries require a CRT DLL that is not found. Static CRT not supported.
if: ${{ matrix.arch != 'arm64' && matrix.plat != 'uwp' }}
timeout-minutes: 10
run: cd bld && ctest -VV -C Release --output-on-failure
build_macos:
name: 'macOS (${{ matrix.build }}, ${{ matrix.crypto.name }})'
runs-on: macos-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
build: [autotools, cmake]
crypto:
- name: 'OpenSSL 3'
install: openssl
configure: --with-crypto=openssl --with-libssl-prefix=/usr/local/opt/openssl
cmake: -DCRYPTO_BACKEND=OpenSSL -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl
- name: 'OpenSSL 1.1'
install: [email protected]
configure: --with-crypto=openssl --with-libssl-prefix=/usr/local/opt/[email protected]
cmake: -DCRYPTO_BACKEND=OpenSSL -DOPENSSL_ROOT_DIR=/usr/local/opt/[email protected]
- name: 'LibreSSL'
install: libressl
configure: --with-crypto=openssl --with-libssl-prefix=/usr/local/opt/libressl
cmake: -DCRYPTO_BACKEND=OpenSSL -DOPENSSL_ROOT_DIR=/usr/local/opt/libressl
- name: 'wolfSSL'
install: wolfssl
configure: --with-crypto=wolfssl --with-libwolfssl-prefix=/usr/local/opt/wolfssl
cmake: -DCRYPTO_BACKEND=wolfSSL
- name: 'libgcrypt'
install: libgcrypt
configure: --with-crypto=libgcrypt --with-libgcrypt-prefix=/usr/local/opt/libgcrypt
cmake: -DCRYPTO_BACKEND=Libgcrypt
- name: 'mbedTLS'
install: mbedtls
configure: --with-crypto=mbedtls --with-libmbedcrypto-prefix=/usr/local/opt/mbedtls
cmake: -DCRYPTO_BACKEND=mbedTLS -DMBEDCRYPTO_LIBRARY=/usr/local/opt/mbedtls/lib/libmbedcrypto.a -DMBEDTLS_LIBRARY=/usr/local/opt/mbedtls/lib/libmbedtls.a -DMBEDX509_LIBRARY=/usr/local/opt/mbedtls/lib/libmbedx509.a -DMBEDTLS_INCLUDE_DIR=/usr/local/opt/mbedtls/include
steps:
- name: 'install packages'
run: brew install automake ${{ matrix.crypto.install }}
- uses: actions/checkout@v3
- name: 'autotools autoreconf'
if: ${{ matrix.build == 'autotools' }}
run: autoreconf -fi
- name: 'autotools configure'
if: ${{ matrix.build == 'autotools' }}
run: |
mkdir bld && cd bld && ../configure --enable-werror --enable-debug \
--with-libz ${{ matrix.crypto.configure }} \
--disable-docker-tests \
--disable-sshd-tests
- name: 'autotools build'
if: ${{ matrix.build == 'autotools' }}
run: make -C bld -j3
- name: 'autotools tests'
if: ${{ matrix.build == 'autotools' }}
timeout-minutes: 10
run: make -C bld check VERBOSE=1
- name: 'cmake configure'
if: ${{ matrix.build == 'cmake' }}
run: |
cmake . -B bld ${{ matrix.crypto.cmake }} \
-DCMAKE_UNITY_BUILD=ON \
-DENABLE_WERROR=ON \
-DENABLE_DEBUG_LOGGING=ON \
-DENABLE_ZLIB_COMPRESSION=ON \
-DRUN_DOCKER_TESTS=OFF \
-DRUN_SSHD_TESTS=OFF
- name: 'cmake build'
if: ${{ matrix.build == 'cmake' }}
run: cmake --build bld --parallel 3
- name: 'cmake tests'
if: ${{ matrix.build == 'cmake' }}
timeout-minutes: 10
run: cd bld && ctest -VV --output-on-failure