mirror of
https://github.com/libssh2/libssh2.git
synced 2025-08-01 11:26:53 +03:00
ci: add MSVC and UWP builds to GitHub Actions
- add MSVC jobs to GitHub Actions. They are similar to the 'Build-only'
jobs we have on AppVeyor CI, though only the ARM64 Windows one is
identical. Major disadvantage is that we don't run tests here. Major
advantage is they only take a few minutes to complete, compared to
an hour on AppVeyor, so WinCNG build results now appear quicker.
Docker tests might be possible, but my light attempts failed.
Finding ZLIB also failed, so we still miss an MSVC test with it.
Tool versions as of now: Server 2022, VS2022, OpenSSL 1.1.1
- add UWP builds for both ARM64 and x64. This hasn't been CI tested
before.
(We could probably enable UWP on AppVeyor CI as well.
I haven't tried.)
- fix two uncovered UWP issues in tests.
- rename internal macro `LIBSSH2_WINDOWS_APP` to `LIBSSH2_WINDOWS_UWP`.
Follow-up to 2addafb77b
- fold long lines and quote truthy values in `.github/workflows/ci.yml`.
Closes #1010
This commit is contained in:
57
.github/workflows/ci.yml
vendored
57
.github/workflows/ci.yml
vendored
@ -26,18 +26,18 @@ jobs:
|
|||||||
compiler: [gcc, clang]
|
compiler: [gcc, clang]
|
||||||
address_size: [64]
|
address_size: [64]
|
||||||
crypto_backend: [OpenSSL, Libgcrypt, mbedTLS]
|
crypto_backend: [OpenSSL, Libgcrypt, mbedTLS]
|
||||||
enable_zlib_compression: [OFF, ON]
|
enable_zlib_compression: ['OFF', 'ON']
|
||||||
b: [cmake]
|
b: [cmake]
|
||||||
include:
|
include:
|
||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
address_size: 64
|
address_size: 64
|
||||||
crypto_backend: OpenSSL
|
crypto_backend: OpenSSL
|
||||||
enable_zlib_compression: OFF
|
enable_zlib_compression: 'OFF'
|
||||||
b: configure
|
b: configure
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
address_size: 64
|
address_size: 64
|
||||||
crypto_backend: OpenSSL
|
crypto_backend: OpenSSL
|
||||||
enable_zlib_compression: OFF
|
enable_zlib_compression: 'OFF'
|
||||||
b: configure
|
b: configure
|
||||||
env:
|
env:
|
||||||
CC: ${{ matrix.compiler }}
|
CC: ${{ matrix.compiler }}
|
||||||
@ -57,7 +57,9 @@ jobs:
|
|||||||
MBEDTLSVER=mbedtls-3.4.0
|
MBEDTLSVER=mbedtls-3.4.0
|
||||||
curl -L https://github.com/Mbed-TLS/mbedtls/archive/$MBEDTLSVER.tar.gz | tar -xzf -
|
curl -L https://github.com/Mbed-TLS/mbedtls/archive/$MBEDTLSVER.tar.gz | tar -xzf -
|
||||||
cd mbedtls-$MBEDTLSVER
|
cd mbedtls-$MBEDTLSVER
|
||||||
cmake $TOOLCHAIN_OPTION -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DCMAKE_INSTALL_PREFIX:PATH=../usr .
|
cmake $TOOLCHAIN_OPTION \
|
||||||
|
-DUSE_SHARED_MBEDTLS_LIBRARY=ON \
|
||||||
|
-DCMAKE_INSTALL_PREFIX:PATH=../usr .
|
||||||
make -j3 install
|
make -j3 install
|
||||||
cd ..
|
cd ..
|
||||||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/usr/lib" >> $GITHUB_ENV
|
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/usr/lib" >> $GITHUB_ENV
|
||||||
@ -75,7 +77,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir bin
|
mkdir bin
|
||||||
cd bin
|
cd bin
|
||||||
cmake $TOOLCHAIN_OPTION -DENABLE_WERROR=ON -DCRYPTO_BACKEND=$CRYPTO_BACKEND -DBUILD_SHARED_LIBS=ON -DENABLE_ZLIB_COMPRESSION=$ENABLE_ZLIB_COMPRESSION ..
|
cmake $TOOLCHAIN_OPTION \
|
||||||
|
-DENABLE_WERROR=ON \
|
||||||
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
|
-DCRYPTO_BACKEND=$CRYPTO_BACKEND \
|
||||||
|
-DENABLE_ZLIB_COMPRESSION=$ENABLE_ZLIB_COMPRESSION ..
|
||||||
cmake --build .
|
cmake --build .
|
||||||
export OPENSSH_SERVER_IMAGE=ghcr.io/libssh2/ci_tests_openssh_server:$(git rev-parse --short=20 HEAD:../tests/openssh_server)
|
export OPENSSH_SERVER_IMAGE=ghcr.io/libssh2/ci_tests_openssh_server:$(git rev-parse --short=20 HEAD:../tests/openssh_server)
|
||||||
ctest -VV --output-on-failure
|
ctest -VV --output-on-failure
|
||||||
@ -109,3 +115,44 @@ jobs:
|
|||||||
./configure --enable-debug --enable-static --disable-shared --with-crypto=openssl
|
./configure --enable-debug --enable-static --disable-shared --with-crypto=openssl
|
||||||
make -j3
|
make -j3
|
||||||
make check VERBOSE=1
|
make check VERBOSE=1
|
||||||
|
|
||||||
|
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' }
|
||||||
|
- { arch: x64 , plat: windows, crypto: WinCNG , log: 'ON' , shared: 'ON' , zlib: 'OFF' }
|
||||||
|
- { arch: x64 , plat: windows, crypto: OpenSSL, log: 'OFF', shared: 'ON' , zlib: 'OFF' }
|
||||||
|
- { arch: x64 , plat: uwp , crypto: WinCNG , log: 'OFF', shared: 'ON' , zlib: 'OFF' }
|
||||||
|
- { arch: arm64, plat: windows, crypto: WinCNG , log: 'OFF', shared: 'ON' , zlib: 'OFF' }
|
||||||
|
- { arch: arm64, plat: uwp , crypto: WinCNG , log: 'OFF', shared: 'ON' , zlib: 'OFF' }
|
||||||
|
- { arch: x86 , plat: windows, crypto: WinCNG , log: 'OFF', shared: 'ON' , zlib: 'OFF' }
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Configure with CMake
|
||||||
|
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}} \
|
||||||
|
-DENABLE_WERROR=ON \
|
||||||
|
-DENABLE_DEBUG_LOGGING=${{matrix.log}} \
|
||||||
|
-DBUILD_SHARED_LIBS=${{matrix.shared}} \
|
||||||
|
-DCRYPTO_BACKEND=${{matrix.crypto}} \
|
||||||
|
-DENABLE_ZLIB_COMPRESSION=${{matrix.zlib}}
|
||||||
|
- name: Build with CMake
|
||||||
|
run: |
|
||||||
|
cmake --build bld --config Release --target package
|
||||||
|
@ -251,7 +251,7 @@ static struct agent_ops agent_ops_unix = {
|
|||||||
};
|
};
|
||||||
#endif /* PF_UNIX */
|
#endif /* PF_UNIX */
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(LIBSSH2_WINDOWS_APP)
|
#if defined(WIN32) && !defined(LIBSSH2_WINDOWS_UWP)
|
||||||
/* Code to talk to Pageant was taken from PuTTY.
|
/* Code to talk to Pageant was taken from PuTTY.
|
||||||
*
|
*
|
||||||
* Portions copyright Robert de Bath, Joris van Rantwijk, Delian
|
* Portions copyright Robert de Bath, Joris van Rantwijk, Delian
|
||||||
@ -354,16 +354,16 @@ static struct agent_ops agent_ops_pageant = {
|
|||||||
agent_transact_pageant,
|
agent_transact_pageant,
|
||||||
agent_disconnect_pageant
|
agent_disconnect_pageant
|
||||||
};
|
};
|
||||||
#endif /* defined(WIN32) && !defined(LIBSSH2_WINDOWS_APP) */
|
#endif /* defined(WIN32) && !defined(LIBSSH2_WINDOWS_UWP) */
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
struct agent_ops *ops;
|
struct agent_ops *ops;
|
||||||
} supported_backends[] = {
|
} supported_backends[] = {
|
||||||
#if defined(WIN32) && !defined(LIBSSH2_WINDOWS_APP)
|
#if defined(WIN32) && !defined(LIBSSH2_WINDOWS_UWP)
|
||||||
{"Pageant", &agent_ops_pageant},
|
{"Pageant", &agent_ops_pageant},
|
||||||
{"OpenSSH", &agent_ops_openssh},
|
{"OpenSSH", &agent_ops_openssh},
|
||||||
#endif
|
#endif /* defined(WIN32) && !defined(LIBSSH2_WINDOWS_UWP) */
|
||||||
#ifdef PF_UNIX
|
#ifdef PF_UNIX
|
||||||
{"Unix", &agent_ops_unix},
|
{"Unix", &agent_ops_unix},
|
||||||
#endif /* PF_UNIX */
|
#endif /* PF_UNIX */
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#include "agent.h"
|
#include "agent.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(LIBSSH2_WINDOWS_APP)
|
#if defined(WIN32) && !defined(LIBSSH2_WINDOWS_UWP)
|
||||||
|
|
||||||
#include <stdlib.h> /* for getenv() */
|
#include <stdlib.h> /* for getenv() */
|
||||||
|
|
||||||
@ -347,4 +347,4 @@ struct agent_ops agent_ops_openssh = {
|
|||||||
agent_transact_openssh,
|
agent_transact_openssh,
|
||||||
agent_disconnect_openssh
|
agent_disconnect_openssh
|
||||||
};
|
};
|
||||||
#endif /* defined(WIN32) && !defined(LIBSSH2_WINDOWS_APP) */
|
#endif /* defined(WIN32) && !defined(LIBSSH2_WINDOWS_UWP) */
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
# include <winapifamily.h>
|
# include <winapifamily.h>
|
||||||
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||||
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
# define LIBSSH2_WINDOWS_APP
|
# define LIBSSH2_WINDOWS_UWP
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,6 +61,14 @@
|
|||||||
#define LIBSSH2_SOCKET_MASK "%d"
|
#define LIBSSH2_SOCKET_MASK "%d"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LIBSSH2_WINDOWS_UWP
|
||||||
|
#define popen(x, y) (NULL)
|
||||||
|
#define pclose(x) (-1)
|
||||||
|
#elif defined(WIN32)
|
||||||
|
#define popen _popen
|
||||||
|
#define pclose _pclose
|
||||||
|
#endif
|
||||||
|
|
||||||
static int have_docker = 0;
|
static int have_docker = 0;
|
||||||
|
|
||||||
int openssh_fixture_have_docker(void)
|
int openssh_fixture_have_docker(void)
|
||||||
@ -102,11 +110,7 @@ static int run_command_varg(char **output, const char *command, va_list args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stdout, "Command: %s\n", command_buf);
|
fprintf(stdout, "Command: %s\n", command_buf);
|
||||||
#ifdef WIN32
|
|
||||||
pipe = _popen(buf, "r");
|
|
||||||
#else
|
|
||||||
pipe = popen(buf, "r");
|
pipe = popen(buf, "r");
|
||||||
#endif
|
|
||||||
if(!pipe) {
|
if(!pipe) {
|
||||||
fprintf(stderr, "Unable to execute command '%s'\n", command);
|
fprintf(stderr, "Unable to execute command '%s'\n", command);
|
||||||
return -1;
|
return -1;
|
||||||
@ -118,11 +122,7 @@ static int run_command_varg(char **output, const char *command, va_list args)
|
|||||||
buf_len = strlen(buf);
|
buf_len = strlen(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
ret = _pclose(pipe);
|
|
||||||
#else
|
|
||||||
ret = pclose(pipe);
|
ret = pclose(pipe);
|
||||||
#endif
|
|
||||||
if(ret) {
|
if(ret) {
|
||||||
fprintf(stderr, "Error running command '%s' (exit %d): %s\n",
|
fprintf(stderr, "Error running command '%s' (exit %d): %s\n",
|
||||||
command, ret, buf);
|
command, ret, buf);
|
||||||
|
Reference in New Issue
Block a user