Fix markdown changelog generation test

System tests typically run outside the workspace directory, but they
still have read-only access to the workspace; fix it accordingly.
This test only works on git checkouts, not in tarballs, so skip it
if .git doesn't exist.
This commit is contained in:
Johannes Altmanninger
2025-09-25 11:47:04 +02:00
parent b8f704e3c4
commit 6e90d9bd6f
3 changed files with 25 additions and 15 deletions

View File

@@ -22,7 +22,7 @@ jobs:
sudo apt install gettext libpcre2-dev python3-pexpect python3-sphinx tmux
# Generate a locale that uses a comma as decimal separator.
sudo locale-gen fr_FR.UTF-8
# - uses: ./.github/actions/install-sphinx-markdown-builder
- uses: ./.github/actions/install-sphinx-markdown-builder
- name: cmake
run: |
mkdir build && cd build

View File

@@ -11,15 +11,18 @@ mkdir -p "$relnotes_tmp/fake-workspace" "$relnotes_tmp/out"
cp -r doc_src CONTRIBUTING.rst README.rst "$relnotes_tmp/fake-workspace"
)
version=$(sed 's,^fish \(\S*\) .*,\1,; 1q' "$workspace_root/CHANGELOG.rst")
previous_version=$(awk <"$workspace_root/CHANGELOG.rst" '
( /^fish \S*\.\S*\.\S* \(released .*\)$/ &&
NR > 1 &&
# Skip tags that have not been created yet..
system("git rev-parse --verify >/dev/null --quiet refs/tags/"$2) == 0 \
) {
print $2; exit
}
')
previous_version=$(
cd "$workspace_root"
awk <CHANGELOG.rst '
( /^fish \S*\.\S*\.\S* \(released .*\)$/ &&
NR > 1 &&
# Skip tags that have not been created yet..
system("git rev-parse --verify >/dev/null --quiet refs/tags/"$2) == 0 \
) {
print $2; exit
}
'
)
minor_version=${version%.*}
changelog_for_this_version=$(awk <"$workspace_root/CHANGELOG.rst" '
/^===/ { if (v++) { exit } }
@@ -48,7 +51,10 @@ sed -i 1,2d "$relnotes_tmp/out/relnotes.md"
echo ""
echo "---"
echo ""
"$workspace_root"/build_tools/list_committers_since.fish "$previous_version"
(
cd "$workspace_root"
build_tools/list_committers_since.fish "$previous_version"
)
cat <<EOF
---

View File

@@ -2,8 +2,12 @@
#REQUIRES: command -v sphinx-build
#REQUIRES: python -c 'import sphinx_markdown_builder'
set -l build_script (status dirname)/../../build_tools/release-notes.sh
$build_script -q >relnotes.md
set -l workspace_root (status dirname)/../..
if not test -e $workspace_root/.git
return
end
$workspace_root/build_tools/release-notes.sh -q >relnotes.md
or echo "Failed to build Markdown release notes."
sed -n 1p relnotes.md
# CHECK: ## fish {{.*}} (released {{.*}})
sed -n 1p relnotes.md | grep -q '^## fish \S* (released .*)'
or echo "Unexpected changelog title"