Allow git describe to get the version for FreeBSD and Cygwin in CI (#1640)

* Specify `safe.directory`
* Fetch tags
* Fetch all commits
This commit is contained in:
Rangi
2025-01-29 19:57:15 -05:00
committed by GitHub
parent b35e9d86fb
commit 03452c6d4f
4 changed files with 10 additions and 4 deletions

View File

@@ -336,6 +336,9 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Cygwin - name: Setup Cygwin
uses: cygwin/cygwin-install-action@v4 uses: cygwin/cygwin-install-action@v4
with: with:
@@ -363,6 +366,9 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Build & test using CMake on FreeBSD - name: Build & test using CMake on FreeBSD
uses: vmactions/freebsd-vm@v1 uses: vmactions/freebsd-vm@v1
with: with:

View File

@@ -75,7 +75,7 @@ endif()
find_program(GIT git) find_program(GIT git)
if(GIT) if(GIT)
execute_process(COMMAND ${GIT} --git-dir=.git describe --tags --dirty --always execute_process(COMMAND ${GIT} --git-dir=.git -c safe.directory='*' describe --tags --dirty --always
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_REV OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE GIT_REV OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET) ERROR_QUIET)

View File

@@ -24,7 +24,7 @@ PNGLDFLAGS := `${PKG_CONFIG} --libs-only-L libpng`
PNGLDLIBS := `${PKG_CONFIG} --libs-only-l libpng` PNGLDLIBS := `${PKG_CONFIG} --libs-only-l libpng`
# Note: if this comes up empty, `version.cpp` will automatically fall back to last release number # Note: if this comes up empty, `version.cpp` will automatically fall back to last release number
VERSION_STRING := `git --git-dir=.git describe --tags --dirty --always 2>/dev/null` VERSION_STRING := `git --git-dir=.git -c safe.directory='*' describe --tags --dirty --always 2>/dev/null`
WARNFLAGS := -Wall -pedantic -Wno-unknown-warning-option -Wno-gnu-zero-variadic-macro-arguments WARNFLAGS := -Wall -pedantic -Wno-unknown-warning-option -Wno-gnu-zero-variadic-macro-arguments
@@ -265,4 +265,4 @@ wine-shim:
dist: dist:
$Qgit ls-files | sed s~^~$${PWD##*/}/~ \ $Qgit ls-files | sed s~^~$${PWD##*/}/~ \
| tar -czf rgbds-`git describe --tags | cut -c 2-`.tar.gz -C .. -T - | tar -czf rgbds-`git -c safe.directory='*' describe --tags | cut -c 2-`.tar.gz -C .. -T -

View File

@@ -45,7 +45,7 @@ tryCmp () {
} }
# Add the version constants test, outputting the closest tag to the HEAD # Add the version constants test, outputting the closest tag to the HEAD
if git describe --tags --abbrev=0 >version.out; then if git -c safe.directory='*' describe --tags --abbrev=0 >version.out; then
$RGBASM --version >>version.out $RGBASM --version >>version.out
cat >version.asm <<EOF cat >version.asm <<EOF
IF !DEF(__RGBDS_RC__) IF !DEF(__RGBDS_RC__)