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
This commit is contained in:
Benjamin Sergeant 2020-03-15 18:38:09 -07:00 committed by GitHub
parent 44f599747e
commit 0bb5462504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 49 deletions

View File

@ -1,12 +1,9 @@
name: unittest name: unittest
on: [push] on: [push]
# fake comment to trigger an action 1
jobs: jobs:
linux: linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: make test - name: make test
@ -14,38 +11,22 @@ jobs:
mac: mac:
runs-on: macOS-latest runs-on: macOS-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: make test - name: make test
run: make test run: make test
# We don't need to have redis running anymore, as we have our fake limited one win:
# - name: install redis runs-on: windows-latest
# run: brew install redis steps:
# - uses: actions/checkout@v1
# - name: start redis server - uses: seanmiddleditch/gha-setup-vsdevenv@master
# run: brew services start redis - 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 # Running the unittest does not work
# win: #- run: ../build/test/ixwebsocket_unittest.exe
# runs-on: windows-2016 # working-directory: test
#
# 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

View File

@ -31,10 +31,6 @@ target_include_directories( ixcrypto PUBLIC ${IXCRYPTO_INCLUDE_DIRS} )
# hmac computation needs a crypto library # hmac computation needs a crypto library
if (WIN32)
set(USE_MBED_TLS TRUE)
endif()
target_compile_definitions(ixcrypto PUBLIC IXCRYPTO_USE_TLS) target_compile_definitions(ixcrypto PUBLIC IXCRYPTO_USE_TLS)
if (USE_MBED_TLS) if (USE_MBED_TLS)
find_package(MbedTLS REQUIRED) find_package(MbedTLS REQUIRED)

View File

@ -14,7 +14,7 @@
#elif defined(IXCRYPTO_USE_OPEN_SSL) #elif defined(IXCRYPTO_USE_OPEN_SSL)
# include <openssl/hmac.h> # include <openssl/hmac.h>
#else #else
# error "Unsupported configuration" # include <assert.h>
#endif #endif
namespace ix namespace ix
@ -40,7 +40,7 @@ namespace ix
(unsigned char *) data.c_str(), (int) data.size(), (unsigned char *) data.c_str(), (int) data.size(),
(unsigned char *) hash, nullptr); (unsigned char *) hash, nullptr);
#else #else
# error "Unsupported configuration" assert(false && "hmac not implemented on this platform");
#endif #endif
std::string hashString(reinterpret_cast<char*>(hash), hashSize); std::string hashString(reinterpret_cast<char*>(hash), hashSize);

View File

@ -9,6 +9,7 @@
#include <atomic> #include <atomic>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <string>
namespace ix namespace ix
{ {

View File

@ -50,19 +50,21 @@ set (SOURCES
IXHttpServerTest.cpp IXHttpServerTest.cpp
IXUnityBuildsTest.cpp IXUnityBuildsTest.cpp
IXHttpTest.cpp IXHttpTest.cpp
IXCobraChatTest.cpp
IXCobraMetricsPublisherTest.cpp
IXDNSLookupTest.cpp IXDNSLookupTest.cpp
IXWebSocketSubProtocolTest.cpp IXWebSocketSubProtocolTest.cpp
IXSentryClientTest.cpp IXSentryClientTest.cpp
IXWebSocketChatTest.cpp IXWebSocketChatTest.cpp
IXCobraToSentryBotTest.cpp
) )
# Some unittest don't work on windows yet # Some unittest don't work on windows yet
if (UNIX) if (UNIX)
list(APPEND SOURCES list(APPEND SOURCES
IXWebSocketCloseTest.cpp IXWebSocketCloseTest.cpp
# Windows without TLS does not have hmac yet
IXCobraChatTest.cpp
IXCobraMetricsPublisherTest.cpp
IXCobraToSentryBotTest.cpp
) )
endif() endif()

View File

@ -76,14 +76,6 @@ target_link_libraries(ws ixbots)
target_link_libraries(ws spdlog) 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) if (JSONCPP_FOUND)
target_include_directories(ws PUBLIC ${JSONCPP_INCLUDE_DIRS}) target_include_directories(ws PUBLIC ${JSONCPP_INCLUDE_DIRS})
target_link_libraries(ws ${JSONCPP_LIBRARIES}) target_link_libraries(ws ${JSONCPP_LIBRARIES})