Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ jobs:
uses: actions/cache/restore@v4
with:
key: deps-${{ matrix.os.name }}-${{ matrix.os.version }}-${{ matrix.compiler.toolset }}-${{ steps.env-info.outputs.compiler-full-version }}-${{ matrix.cpp_version.name }}-${{ matrix.build_type.name }}
path: ${{ github.workspace }}/build/_deps
path: |
${{ github.workspace }}/build/_deps
${{ github.workspace }}/build/.iris_deps_build_stamp

# Adapt CMP0168; enable caching in CI
# https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_FULLY_DISCONNECTED
Expand All @@ -172,16 +174,38 @@ jobs:
-DIRIS_CI=ON \
-S .

- name: Check Deps build time stamp (pre-build)
id: pre-build-check
shell: bash
run: |
if [ -e build/.iris_deps_build_stamp ]; then
echo "deps-timestamp=$(stat -c %Y build/.iris_deps_build_stamp)" >> $GITHUB_OUTPUT
else
echo "deps-timestamp=0" >> $GITHUB_OUTPUT
fi

- name: Try building Deps
run: |
cmake --build build --config ${{ matrix.build_type.name }} -j${{ env.IRIS_BUILD_JOBS }} --target iris_deps_build_check ${{ matrix.compiler.builder_additional_args }}

- name: Check Deps build time stamp (post-build)
id: post-build-check
shell: bash
run: |
echo "deps-timestamp=$(stat -c %Y build/.iris_deps_build_stamp)" >> $GITHUB_OUTPUT

- name: Build Tests
run: |
cmake --build build --config ${{ matrix.build_type.name }} -j${{ env.IRIS_BUILD_JOBS }} ${{ matrix.compiler.builder_additional_args }}

- name: Cache CMake Dependencies (save)
if: steps.cache-deps.outputs.cache-hit != 'true'
if: steps.cache-deps.outputs.cache-hit != 'true' || steps.pre-build-check.outputs.deps-timestamp != steps.post-build-check.outputs.deps-timestamp
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-deps.outputs.cache-primary-key }}
path: ${{ github.workspace }}/build/_deps
path: |
${{ github.workspace }}/build/_deps
${{ github.workspace }}/build/.iris_deps_build_stamp

- name: Test
env:
Expand Down
10 changes: 10 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ target_link_libraries(Catch2WithMain PRIVATE iris_cxx_test_external)

target_link_libraries(iris_cxx_test INTERFACE Catch2::Catch2WithMain)

if (IRIS_CI)
set(IRIS_DEPS_STAMP "${CMAKE_BINARY_DIR}/.iris_deps_build_stamp")
add_custom_command(
OUTPUT "${IRIS_DEPS_STAMP}"
COMMAND touch "${IRIS_DEPS_STAMP}"
DEPENDS Catch2::Catch2
COMMENT "Deps is rebuilt"
)
add_custom_target(iris_deps_build_check ALL DEPENDS "${IRIS_DEPS_STAMP}")
endif()

# -----------------------------------------------------------------
# Common CMake utilities for testing
Expand Down
Loading