From 0bb546250419915cc65990321d814082fa945dbf Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Sun, 15 Mar 2020 18:38:09 -0700 Subject: [PATCH] Feature/ci windows (#163) * win only * disable ixcrypto mbedtls search on windows * ws cmakefile do not search for openssl * ci builds files on top of cmaking * ci builds files on top of cmaking / syntax tweak * use gha-setup-vsdevenv syntax * build fix and hacks * try to run unittest on win * try to run unittest on win (syntax error) * unittest wip * wip * wip again * wip again (working-directory) * cleanup * dumb compile error --- .github/workflows/ccpp.yml | 45 ++++++++++----------------------- ixcrypto/CMakeLists.txt | 4 --- ixcrypto/ixcrypto/IXHMac.cpp | 4 +-- ixsnake/ixsnake/IXRedisClient.h | 1 + test/CMakeLists.txt | 8 +++--- ws/CMakeLists.txt | 8 ------ 6 files changed, 21 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 6ed44c76..e8c35319 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -1,12 +1,9 @@ name: unittest - on: [push] -# fake comment to trigger an action 1 jobs: linux: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v1 - name: make test @@ -14,38 +11,22 @@ jobs: mac: runs-on: macOS-latest - steps: - uses: actions/checkout@v1 - name: make test run: make test - # We don't need to have redis running anymore, as we have our fake limited one - # - name: install redis - # run: brew install redis - # - # - name: start redis server - # run: brew services start redis + win: + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - uses: seanmiddleditch/gha-setup-vsdevenv@master + - run: | + mkdir build + cd build + cmake -DCMAKE_CXX_COMPILER=cl.exe -DUSE_WS=1 -DUSE_TEST=1 .. + - run: cmake --build build - # # Windows does not work yet, I'm stuck at getting CMake to run + finding vcpkg - # win: - # runs-on: windows-2016 - # - # steps: - # - uses: actions/checkout@v1 - # - # - name: run cmake - # run: | - # "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" - # mkdir build - # cd build - # cmake -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake -DUSE_WS=1 -DUSE_TEST=1 -DUSE_TLS=1 -G"NMake Makefiles" .. - # - name: build - # run: | - # "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" - # cd build - # nmake - # - name: run tests - # run: - # cd test - # ..\build\test\ixwebsocket_unittest.exe + # Running the unittest does not work + #- run: ../build/test/ixwebsocket_unittest.exe + # working-directory: test diff --git a/ixcrypto/CMakeLists.txt b/ixcrypto/CMakeLists.txt index c9ae5497..742be4a3 100644 --- a/ixcrypto/CMakeLists.txt +++ b/ixcrypto/CMakeLists.txt @@ -31,10 +31,6 @@ target_include_directories( ixcrypto PUBLIC ${IXCRYPTO_INCLUDE_DIRS} ) # hmac computation needs a crypto library -if (WIN32) - set(USE_MBED_TLS TRUE) -endif() - target_compile_definitions(ixcrypto PUBLIC IXCRYPTO_USE_TLS) if (USE_MBED_TLS) find_package(MbedTLS REQUIRED) diff --git a/ixcrypto/ixcrypto/IXHMac.cpp b/ixcrypto/ixcrypto/IXHMac.cpp index 4e203d36..7bc29385 100644 --- a/ixcrypto/ixcrypto/IXHMac.cpp +++ b/ixcrypto/ixcrypto/IXHMac.cpp @@ -14,7 +14,7 @@ #elif defined(IXCRYPTO_USE_OPEN_SSL) # include #else -# error "Unsupported configuration" +# include #endif namespace ix @@ -40,7 +40,7 @@ namespace ix (unsigned char *) data.c_str(), (int) data.size(), (unsigned char *) hash, nullptr); #else -# error "Unsupported configuration" + assert(false && "hmac not implemented on this platform"); #endif std::string hashString(reinterpret_cast(hash), hashSize); diff --git a/ixsnake/ixsnake/IXRedisClient.h b/ixsnake/ixsnake/IXRedisClient.h index d965ae84..2e628eb7 100644 --- a/ixsnake/ixsnake/IXRedisClient.h +++ b/ixsnake/ixsnake/IXRedisClient.h @@ -9,6 +9,7 @@ #include #include #include +#include namespace ix { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 30717aaf..ec16a06c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -50,19 +50,21 @@ set (SOURCES IXHttpServerTest.cpp IXUnityBuildsTest.cpp IXHttpTest.cpp - IXCobraChatTest.cpp - IXCobraMetricsPublisherTest.cpp IXDNSLookupTest.cpp IXWebSocketSubProtocolTest.cpp IXSentryClientTest.cpp IXWebSocketChatTest.cpp - IXCobraToSentryBotTest.cpp ) # Some unittest don't work on windows yet if (UNIX) list(APPEND SOURCES IXWebSocketCloseTest.cpp + + # Windows without TLS does not have hmac yet + IXCobraChatTest.cpp + IXCobraMetricsPublisherTest.cpp + IXCobraToSentryBotTest.cpp ) endif() diff --git a/ws/CMakeLists.txt b/ws/CMakeLists.txt index 275109e4..4d636531 100644 --- a/ws/CMakeLists.txt +++ b/ws/CMakeLists.txt @@ -76,14 +76,6 @@ target_link_libraries(ws ixbots) target_link_libraries(ws spdlog) -if(NOT APPLE AND NOT USE_MBED_TLS) - find_package(OpenSSL REQUIRED) - add_definitions(${OPENSSL_DEFINITIONS}) - message(STATUS "OpenSSL: " ${OPENSSL_VERSION}) - include_directories(${OPENSSL_INCLUDE_DIR}) - target_link_libraries(ws ${OPENSSL_LIBRARIES}) -endif() - if (JSONCPP_FOUND) target_include_directories(ws PUBLIC ${JSONCPP_INCLUDE_DIRS}) target_link_libraries(ws ${JSONCPP_LIBRARIES})