diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bac8f53 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +name: build and run tests +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: mkdir + run: mkdir build + - name: cmake build + run: cmake -Bbuild -H. + - name: cmake make + run: cmake --build build/ --target all + # run tests + - name: run tests 1 + run: build/tests/testQRCode diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2e843b8..b73ea99 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,15 +1,13 @@ find_package(Threads REQUIRED) -# Enable ExternalProject CMake module include(ExternalProject) -# Download and install GoogleTest ExternalProject_Add( gtest - URL https://github.com/google/googletest/archive/refs/heads/main.zip + URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.zip PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gtest - # Disable install step INSTALL_COMMAND "" + URL_HASH SHA1=9ffb7b5923f4a8fcdabf2f42c6540cce299f44c0 ) ExternalProject_Get_Property(gtest source_dir binary_dir) @@ -22,18 +20,9 @@ set_target_properties(libgtest PROPERTIES "IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}" ) -add_library(libgmock IMPORTED STATIC GLOBAL) -add_dependencies(libgmock gtest) - -set_target_properties(libgmock PROPERTIES -"IMPORTED_LOCATION" "${binary_dir}/lib/libgmock.a" -"IMPORTED_LINK_INTERFACE_LIBRARIES" "${CMAKE_THREAD_LIBS_INIT}" -) - -# I couldn't make it work with INTERFACE_INCLUDE_DIRECTORIES -include_directories("${source_dir}/googletest/include" - "${source_dir}/googlemock/include") +include_directories("${source_dir}/googletest/include") +# Tests build file(GLOB SRCS *.cpp) @@ -42,7 +31,6 @@ ADD_EXECUTABLE(testQRCode ${SRCS}) TARGET_LINK_LIBRARIES(testQRCode QRCodeLibrary libgtest - libgmock ) add_test(NAME testQRCode