From 1b5c7788c8853fd948bc04488a8ff3bb93aaeb61 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 17 Feb 2025 20:44:21 +0900 Subject: [PATCH] Attempt to fix build when git-describe fails --- .github/workflows/unittest.yml | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index aec440f..f398a66 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -11,7 +11,7 @@ jobs: - name: Get cmake/gcc run: sudo apt-get -y install cmake gcc sed - name: Clone repo - run: git clone https://github.com/Stephen-Seo/SimpleArchiver.git + run: git clone --depth=1 --no-single-branch https://github.com/Stephen-Seo/SimpleArchiver.git - name: Checkout the branch run: cd SimpleArchiver && git checkout "${GITHUB_REF_NAME}" - name: Patch CMakeLists.txt to remove "-fstrict-flex-arrays=3" which is unavailable in ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index ac9d78f..d6272ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,7 @@ set_source_files_properties(src/archiver.c if(EXISTS /usr/bin/git AND EXISTS /usr/bin/sh AND EXISTS /usr/bin/cat AND EXISTS /usr/bin/xargs AND EXISTS /usr/bin/sed) add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/version_string.txt" - COMMAND /usr/bin/sh ARGS -c "/usr/bin/git describe --long --tags >${CMAKE_CURRENT_BINARY_DIR}/version_string.txt" + COMMAND /usr/bin/sh ARGS -c "/usr/bin/git describe --long --tags >${CMAKE_CURRENT_BINARY_DIR}/version_string.txt || /usr/bin/echo ${SimpleArchiver_VERSION} >${CMAKE_CURRENT_BINARY_DIR}/version_string.txt" COMMAND /usr/bin/sh ARGS -c "/usr/bin/cat ${CMAKE_CURRENT_BINARY_DIR}/version_string.txt | /usr/bin/xargs -Iderp sed -i \"/^#define SIMPLE_ARCHIVER_VERSION_STR /c #define SIMPLE_ARCHIVER_VERSION_STR \\\"derp\\\"\" ${CMAKE_CURRENT_SOURCE_DIR}/src/version.h" COMMAND /usr/bin/rm ARGS -f "${CMAKE_CURRENT_BINARY_DIR}/version_string.txt" VERBATIM) -- 2.49.0