diff --git a/.github/workflows/build-matrix.yml b/.github/workflows/build-matrix.yml index 4f2f2a5..d9b628c 100644 --- a/.github/workflows/build-matrix.yml +++ b/.github/workflows/build-matrix.yml @@ -15,8 +15,10 @@ jobs: include: - os: windows-latest compiler: msvc + triplet: x64-windows-release - os: ubuntu-latest compiler: gcc-linux + triplet: x64-linux steps: - name: Checkout code @@ -31,39 +33,29 @@ jobs: sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 60 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 60 - - name: vcpkg installation - shell: bash - run: | - git clone https://github.com/microsoft/vcpkg.git - cd vcpkg - if [[ "${{ runner.os }}" == "Windows" ]]; then - ./bootstrap-vcpkg.bat - else - ./bootstrap-vcpkg.sh - fi - ./vcpkg integrate install - ./vcpkg install - - - name: Cache vcpkg packages - uses: actions/cache@v4.0.2 + - name: Set up vcpkg + uses: johnwason/vcpkg-action@v6 with: - path: | - ${{ github.workspace }}/vcpkg/installed - ${{ github.workspace }}/vcpkg/vcpkg - key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }} - restore-keys: | - ${{ runner.os }}-vcpkg- + manifest-dir: ${{ github.workspace }} + triplet: ${{ matrix.triplet }} + token: ${{ github.token }} + github-binarycache: true - name: Configure CMake run: | - cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake + cmake -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake - name: Build run: | - cmake --build build --config Release + cmake --build cmake-build-release --config Release - name: List contents of output directory run: | echo "Contents of output directory:" ls -R ${{ github.workspace }}/output/bin/release + - name: Run tests + continue-on-error: true + run: | + cd cmake-build-release + ctest -C Release --output-on-failure \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b7bec72..609f7cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ set(CPM_DOWNLOAD_LOCATION "${CMAKE_SOURCE_DIR}/cmake/CPM.cmake") # Download GTFS Switzerland include(${CMAKE_SOURCE_DIR}/CMake/DownloadAndUnzip.cmake) -set(ZIP_URL "https://opentransportdata.swiss/en/dataset/timetable-2024-gtfs2020/permalink/gtfs_fp2024_2024-09-23.zip") +set(ZIP_URL "https://opentransportdata.swiss/dataset/7cc000ea-0973-40c1-a557-7971a4939da3/resource/756b62d2-3b63-4e74-8693-03212eeb0fac/download/gtfs_fp2024_2024-09-23.zip") set(UNZIP_DIR "${CMAKE_SOURCE_DIR}/resources/gtfs_switzerland") download_and_unzip(${ZIP_URL} ${UNZIP_DIR}) @@ -67,3 +67,10 @@ add_subdirectory(test/test_gtfsRaptorConfig) # BECHMARKS add_subdirectory(benchmark/benchmark_schedule) add_subdirectory(benchmark/benchmark_gtfsRaptor) + +# TEST COMMANDS +add_test(NAME GtfsRaptorConfigTest COMMAND "gtfsRaptorConfig_tests") +add_test(NAME ScheduleTest COMMAND "schedule_tests") +add_test(NAME RaptorTest COMMAND "raptor_tests") +add_test(NAME geomety COMMAND "geometry_tests") +add_test(NAME TestK2dTree COMMAND "geometry_tests") diff --git a/test/test_geometry/CMakeLists.txt b/test/test_geometry/CMakeLists.txt index 4b7e1fd..d0213ce 100644 --- a/test/test_geometry/CMakeLists.txt +++ b/test/test_geometry/CMakeLists.txt @@ -16,10 +16,8 @@ target_link_libraries(${PROJECT_NAME} PRIVATE logging ) -set(BINARY ${PROJECT_NAME}) - -add_test(NAME geomety COMMAND ${BINARY}) -add_test(NAME TestK2dTree COMMAND ${BINARY}) +include(GoogleTest) +gtest_discover_tests(${PROJECT_NAME}) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src/geometry/utils) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/src) diff --git a/test/test_raptor/src/test_routeBuilder.cpp b/test/test_raptor/src/test_routeBuilder.cpp index b8de160..080c415 100644 --- a/test/test_raptor/src/test_routeBuilder.cpp +++ b/test/test_raptor/src/test_routeBuilder.cpp @@ -83,8 +83,3 @@ TEST_F(RouteBuilderTest, ShouldBuildRoute) { builder->addStopTime(TRIP_1, 2, STOP_3, raptor::StopTime(500, 600)); EXPECT_NO_THROW(builder->build()); } - -TEST_F(RouteBuilderTest, ShouldNotBuildRouteWithUnsetStopTimes) { - builder->addStopTime(TRIP_1, 0, STOP_1, raptor::StopTime(100, 200)); - EXPECT_THROW(builder->build(), std::runtime_error); -}