From accc8ce8103a27d6d75f8a9564316fcc12d73eae Mon Sep 17 00:00:00 2001 From: Dominik Drexler Date: Mon, 8 Jan 2024 18:05:42 +0100 Subject: [PATCH] update unittest workflow with new dependency handling --- .github/workflows/benchmarks.yml | 4 +-- .github/workflows/unittests.yml | 42 ++++++++++++-------------------- 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index b994b019..5a044524 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -28,7 +28,7 @@ jobs: dependencies/benchmark-install dependencies/boost dependencies/googletest-install - key: ${{ runner.os }}-benchmark-${{ hashFiles('**/dependencies/benchmark/CMakeLists.txt', '**/dependencies/googletest/CMakeLists.txt') }} # Unique key based on OS and CMake file + key: ${{ runner.os }}-benchmark-${{ hashFiles('**/dependencies/benchmark/CMakeLists.txt', '**/dependencies/boost/CMakeLists.txt', '**/dependencies/googletest/CMakeLists.txt') }} # Unique key based on OS and CMake files - name: Configure, Build, and Install Dependencies if: steps.cache-dependencies.outputs.cache-hit != 'true' @@ -38,7 +38,7 @@ jobs: - name: Configure, and Build Loki run: | - cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_BENCHMARKING:BOOL=TRUE -S . -B build + cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_BENCHMARKING=ON -S . -B build cmake --build build -j$(nproc) # Run benchmarks and store the output to a file diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index c83c64a3..c585a05c 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -9,38 +9,26 @@ jobs: - name: Checkout Loki uses: actions/checkout@v2 - - name: Checkout Google Test - uses: actions/checkout@v2 - with: - repository: google/googletest - path: 'googletest' - ref: 'dddb219c3eb96d7f9200f09b0a381f016e6b4562' # stick to a commit to avoid added future dependencies - - - name: Cache Google Test - id: cache-googletest + - name: Cache Dependencies + id: cache-dependencies uses: actions/cache@v2 with: - path: googletest-install - key: ${{ runner.os }}-googletest-${{ hashFiles('**/googletest/CMakeLists.txt') }} # Unique key based on OS and CMake file - - - name: Build and Install Google Test - if: steps.cache-googletest.outputs.cache-hit != 'true' + path: | + dependencies/benchmark-install + dependencies/boost + dependencies/googletest-install + key: ${{ runner.os }}-benchmark-${{ hashFiles('**/dependencies/benchmark/CMakeLists.txt', '**/dependencies/boost/CMakeLists.txt', '**/dependencies/googletest/CMakeLists.txt') }} # Unique key based on OS and CMake files + + - name: Configure, Build, and Install Dependencies + if: steps.cache-dependencies.outputs.cache-hit != 'true' run: | - cd googletest - cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/googletest-install" - cmake --build build -j$(nproc) - cmake --install build + cmake -S dependencies -B dependencies/build + cmake --build dependencies/build -j$(nproc) - - name: Download and extract boost, no building required + - name: Configure, and Build Loki run: | - wget --no-check-certificate 'https://archives.boost.io/release/1.84.0/source/boost_1_84_0.tar.gz' - tar xf boost_1_84_0.tar.gz - - - name: Configure CMake - run: cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING:BOOL=TRUE -DCMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/googletest-install;$GITHUB_WORKSPACE/boost_1_84_0" -S . -B build - - - name: Build Loki - run: export CXXFLAGS="-Werror" && cmake --build build -j$(nproc) + cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=ON -S . -B build + cmake --build build -j$(nproc) - name: Test working-directory: build/tests/unit