From 0b53bfcc3341d5d3ecc2fa473bc44563aa713ee5 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Tue, 25 Jul 2023 16:04:14 -0600 Subject: [PATCH 1/2] Address git describe errors in GitHub Actions jobs This commit contains changes to try to fix the tests TriBITS_build_docs and TriBITS_build_sphinx_docs where the `git describe --match="*"` command fails complaining there are not tags in the repo. It seems that GitHub actions removed tag info with its git clone. We have to those tags back because they are used to generate the documentation which includes the exact version. A git fetch was done to bring back the tags. However, that did not seem to work. This commit also contains error handling for git describe command to produce a dummy TribitsGitVersion.txt file in case the the git describe command fails. This seems to have allowed the tests to pass. --- .github/workflows/tribits_testing.yml | 6 ++++++ tribits/doc/utils/gen_doc_utils.sh | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tribits_testing.yml b/.github/workflows/tribits_testing.yml index 0d013711f..cf29034a9 100644 --- a/.github/workflows/tribits_testing.yml +++ b/.github/workflows/tribits_testing.yml @@ -74,6 +74,12 @@ jobs: which ${{ matrix.config.cxx }} ${{ matrix.config.cxx }} --version if [ "${{ matrix.config.fc }}" = "" ]; then echo "No fortran compiler"; else echo "Checking gfortran path and version" && which ${{ matrix.config.fc }} && ${{ matrix.config.fc }} --version; fi + - name: Fetch repo tags + run: | + echo "Running: git fetch origin 'refs/tags/*:refs/tags/*'" + git fetch origin 'refs/tags/*:refs/tags/*' + echo "Running: git tag" + git tag - name: Run configure, build, test, and submit to CDash run: | cd .. diff --git a/tribits/doc/utils/gen_doc_utils.sh b/tribits/doc/utils/gen_doc_utils.sh index 639aa68dd..2f15d82d4 100644 --- a/tribits/doc/utils/gen_doc_utils.sh +++ b/tribits/doc/utils/gen_doc_utils.sh @@ -51,7 +51,8 @@ function generate_git_version_file { echo echo "Generating git version" echo - echo `git describe --match="$_TRIBITS_TAG_PREFIX*"` > TribitsGitVersion.txt + git describe --match="$_TRIBITS_TAG_PREFIX*" > TribitsGitVersion.txt || \ + echo "$_TRIBITS_TAG_PREFIX.{Unknown version}" > TribitsGitVersion.txt else echo "$_TRIBITS_TAG_PREFIX.{Unknown version}" > TribitsGitVersion.txt fi From 928e5628dafca000f15e505155abb58311738fe4 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Wed, 26 Jul 2023 16:29:53 -0600 Subject: [PATCH 2/2] Add --always to git describe command This will at least provide the SHA1 in case there is no tag info for some reason. This seems to be the case with GitHub Actions recently. --- tribits/doc/utils/gen_doc_utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tribits/doc/utils/gen_doc_utils.sh b/tribits/doc/utils/gen_doc_utils.sh index 2f15d82d4..253418e44 100644 --- a/tribits/doc/utils/gen_doc_utils.sh +++ b/tribits/doc/utils/gen_doc_utils.sh @@ -51,7 +51,7 @@ function generate_git_version_file { echo echo "Generating git version" echo - git describe --match="$_TRIBITS_TAG_PREFIX*" > TribitsGitVersion.txt || \ + git describe --always --match="$_TRIBITS_TAG_PREFIX*" > TribitsGitVersion.txt || \ echo "$_TRIBITS_TAG_PREFIX.{Unknown version}" > TribitsGitVersion.txt else echo "$_TRIBITS_TAG_PREFIX.{Unknown version}" > TribitsGitVersion.txt