Skip to content

Commit

Permalink
Address git describe errors in GitHub Actions jobs
Browse files Browse the repository at this point in the history
This commit contains changes to try to fix the tests TriBITS_build_docs and
TriBITS_build_sphinx_docs where the `git describe --match="<tag-base-name>*"`
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.
  • Loading branch information
bartlettroscoe committed Jul 26, 2023
1 parent f77cf6f commit 30312ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/tribits_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down
3 changes: 2 additions & 1 deletion tribits/doc/utils/gen_doc_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 30312ca

Please sign in to comment.