From d204f1f497d5b493d4e7091e7b12176dd5292a88 Mon Sep 17 00:00:00 2001 From: Dawid Drozd Date: Mon, 21 Jan 2019 17:32:36 +0100 Subject: [PATCH] Add appveyor CI config file Each line in `- cmd: >-` needs extra new line (why?) For now disable some flags that do not work for Visual Studio Fix tests for Visual Studio --- README.md | 2 +- appveyor.yml | 61 ++++++++++++++++++++++++++++++++++ test/CMakeLists.txt | 24 ++++++------- test/src/AsyncEventBusTest.cpp | 4 +-- 4 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 appveyor.yml diff --git a/README.md b/README.md index 9d08236..cbd5bd5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # EventBus [![GitHub version](https://badge.fury.io/gh/gelldur%2FEventBus.svg)](https://badge.fury.io/gh/gelldur%2FEventBus)   [![Build status for Travis](https://travis-ci.org/gelldur/EventBus.svg?branch=master)](https://travis-ci.org/gelldur/EventBus) -  [![Build status for Appveyor](https://ci.appveyor.com/api/projects/status/github/gelldur/EventBus)](https://ci.appveyor.com/project/gelldur/EventBus) +  [![Build status for Appveyor](https://ci.appveyor.com/api/projects/status/s463l4o3rhegtx00?svg=true)](https://ci.appveyor.com/project/gelldur/EventBus) Simple and very fast event bus. The EventBus library is a convenient realization of the observer pattern. diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..32301f5 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,61 @@ +version: build-{build} +image: Visual Studio 2017 +configuration: + - Release + - Debug + +platform: + - x64 + +cache: C:/Users/appveyor/.local + +install: +- cmd: >- + pwd + + rm -rf .cache + + mkdir -p .cache + + cd .cache + + curl -L https://github.com/catchorg/Catch2/archive/v2.3.0.zip --output Catch2-v2.3.0.zip + + 7z x Catch2-v2.3.0.zip && cd Catch2-2.3.0 + + mkdir -p build && cd build + + cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_INSTALL_PREFIX=~/.local/ .. && cmake --build . --target install --config %CONFIGURATION% + + cd ../../.. + + pwd +nuget: + disable_publish_on_pr: true + disable_publish_octopus: true + +build_script: +- cmd: >- + cd lib + + mkdir build-%CONFIGURATION% && cd build-%CONFIGURATION% + + pwd + + cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_INSTALL_PREFIX=~/.local .. && cmake --build . --target install --config %CONFIGURATION% + + cd ../.. + + pwd + +test_script: +- cmd: >- + cd test + + mkdir build-%CONFIGURATION% && cd build-%CONFIGURATION% + + cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_INSTALL_PREFIX=~/.local/ .. && cmake --build . --config %CONFIGURATION% && ctest -C %CONFIGURATION% -V . + + cd ../.. + + pwd diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c87cabb..5ab1da5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -25,13 +25,13 @@ add_executable(EventBusTest src/NotifierTest.cpp ) -target_compile_options(EventBusTest PUBLIC - -Wall -pedantic - -Wno-unused-private-field - -Wnon-virtual-dtor - -Wno-gnu - -Werror - ) +#target_compile_options(EventBusTest PUBLIC +# -Wall -pedantic +# -Wno-unused-private-field +# -Wnon-virtual-dtor +# -Wno-gnu +# -Werror +# ) # Don't do such thing: # if(CMAKE_BUILD_TYPE STREQUAL DEBUG) @@ -44,11 +44,11 @@ target_compile_options(EventBusTest PUBLIC # target_compile_definitions(foo PRIVATE "VERBOSITY=$,30,10>") -set(EVENTBUS_DEBUG_FLAGS - -O0 -fno-inline - -DDEBUG - #-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC - ) +#set(EVENTBUS_DEBUG_FLAGS +# -O0 -fno-inline +# -DDEBUG +# #-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC +# ) target_compile_options(EventBusTest PUBLIC "$<$:${EVENTBUS_DEBUG_FLAGS}>") diff --git a/test/src/AsyncEventBusTest.cpp b/test/src/AsyncEventBusTest.cpp index e032f1a..069a1fa 100644 --- a/test/src/AsyncEventBusTest.cpp +++ b/test/src/AsyncEventBusTest.cpp @@ -73,7 +73,7 @@ TEST_CASE("Should unlisten for event When call unlisten inside Listener", "[Asyn const int myToken = 0x23167; - bus.listen(myToken, [&counter, &bus](const SimpleEvent& event) + bus.listen(myToken, [&counter, &bus, myToken](const SimpleEvent& event) { std::cout << "Event from: " << event.id << std::endl; ++counter; @@ -108,7 +108,7 @@ TEST_CASE("Should listen for only 1 event When call unlisten inside Listener", " const int myToken = 0x23167; - bus.listen(myToken, [&counter, &bus](const SimpleEvent& event) + bus.listen(myToken, [&counter, &bus, myToken](const SimpleEvent& event) { std::cout << "Event from: " << event.id << std::endl; ++counter;