From accd6c12030960a705a1e841dfbb6e990ddaee19 Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Wed, 6 Aug 2025 18:53:24 +0200 Subject: [PATCH 1/5] ci: pass --build-config to ctest It's required when using multi-config generators like MSVC on Windows --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 747a9c0..ce263ac 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,11 +23,11 @@ jobs: - uses: actions/checkout@v4 - name: Configure - run: cmake -B build + run: cmake -B build -DCMAKE_BUILD_TYPE=Debug - name: Build - run: cmake --build build --parallel + run: cmake --build build --config Debug --parallel - name: Test working-directory: build - run: ctest --verbose + run: ctest --build-config Debug --verbose From 44acb3a362ad8fa76e9227f9ef4d78f5cef2461a Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Sun, 24 Aug 2025 22:02:33 +0200 Subject: [PATCH 2/5] Do not download git-lfs files by default The test file is really big, and downloading it by default may create issues with users on a slow network. Use a .lfsconfig file to disable LFS downloads. This way, LFS files can be explicitly downloaded via git lfs pull --exclude='' --include='*' --- .lfsconfig | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .lfsconfig diff --git a/.lfsconfig b/.lfsconfig new file mode 100644 index 0000000..2cf1bce --- /dev/null +++ b/.lfsconfig @@ -0,0 +1,2 @@ +[lfs] + fetchexclude = * From d31c687037c688ea4eb1acc6edf57f6f822fd0e9 Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Sun, 24 Aug 2025 22:09:04 +0200 Subject: [PATCH 3/5] build: use Git LFS test data --- CMakeLists.txt | 2 +- src/test_verifier/CMakeLists.txt | 23 ++++++----------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e220af5..4fc6843 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) if (NOT TEAKRA_TEST_ASSETS_DIR) - set(TEAKRA_TEST_ASSETS_DIR "${CMAKE_CURRENT_BINARY_DIR}") + set(TEAKRA_TEST_ASSETS_DIR "${PROJECT_SOURCE_DIR}/src/test_verifier/data") endif() # External libraries diff --git a/src/test_verifier/CMakeLists.txt b/src/test_verifier/CMakeLists.txt index dd5dd6c..c839883 100644 --- a/src/test_verifier/CMakeLists.txt +++ b/src/test_verifier/CMakeLists.txt @@ -14,24 +14,13 @@ target_compile_options(test_verifier PRIVATE ${TEAKRA_CXX_FLAGS}) set(ASSET_SHA256SUM "baffcd4f805a7480d969401792443a34aa39f813b4f0ae49c6365f1d1f3ce120") if(TEAKRA_RUN_TESTS) message(STATUS "Will run Teakra accuracy tests") - # download fixtures if there is none - if(NOT EXISTS "${TEAKRA_TEST_ASSETS_DIR}/teaklite2_tests_result") - message(STATUS "Downloading required samples...") - file(DOWNLOAD - "https://liushuyu.b-cdn.net/teaklite2_tests_result_20181208" - "${TEAKRA_TEST_ASSETS_DIR}/teaklite2_tests_result" - EXPECTED_HASH SHA256=${ASSET_SHA256SUM} - SHOW_PROGRESS - ) + # check if provided fixtures are good + file(SHA256 "${TEAKRA_TEST_ASSETS_DIR}/teaklite2_tests_result.bin" ASSET_CHECKSUM) + if(ASSET_SHA256SUM STREQUAL ASSET_CHECKSUM) + message(STATUS "Unit test sample looks good.") else() - # check if provided fixtures are good - file(SHA256 "${TEAKRA_TEST_ASSETS_DIR}/teaklite2_tests_result" ASSET_CHECKSUM) - if(ASSET_SHA256SUM STREQUAL ASSET_CHECKSUM) - message(STATUS "Unit test sample looks good.") - else() - message(FATAL_ERROR "Unit test sample broken. Please remove the file and re-run CMake.") - endif() + message(FATAL_ERROR "Unit test sample broken. Please download the file using: git lfs pull --exclude='' --include='*'") endif() - add_test(NAME tests COMMAND test_verifier "${TEAKRA_TEST_ASSETS_DIR}/teaklite2_tests_result") + add_test(NAME tests COMMAND test_verifier "${TEAKRA_TEST_ASSETS_DIR}/teaklite2_tests_result.bin") endif(TEAKRA_RUN_TESTS) From 22d198502a14b92845e6ae22f53daafa6a9b3efa Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Wed, 6 Aug 2025 18:39:04 +0200 Subject: [PATCH 4/5] ci: enable test assets and cache them --- .github/workflows/build.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ce263ac..81f5edb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,8 +22,22 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Cache test assets + uses: actions/cache@v4 + with: + path: build/teaklite2_tests_result.bin + enableCrossOsArchive: true + key: 'baffcd4f805a7480d969401792443a34aa39f813b4f0ae49c6365f1d1f3ce120' + + - name: Download test assets + if: "!hashFiles('build/teaklite2_tests_result.bin')" + run: | + git lfs pull --exclude='' --include='*' + mkdir -p build + mv src/test_verifier/data/teaklite2_tests_result.bin build/teaklite2_tests_result.bin + - name: Configure - run: cmake -B build -DCMAKE_BUILD_TYPE=Debug + run: cmake -B build -DCMAKE_BUILD_TYPE=Debug -DTEAKRA_RUN_TESTS=ON -DTEAKRA_TEST_ASSETS_DIR="$PWD/build" - name: Build run: cmake --build build --config Debug --parallel From 09f64b7789d8640cf0f79cabcf5d91a769e7943c Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Wed, 6 Aug 2025 19:10:21 +0200 Subject: [PATCH 5/5] ci: limit runs to the master branch This avoids duplicated runs on merge requests --- .github/workflows/build.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 81f5edb..1181b88 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -5,7 +5,11 @@ name: build on: push: + branches: + - master pull_request: + branches: + - master workflow_dispatch: permissions: