From 6e90d9bd6f8adf920c9b97b4692116e488761d1e Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 25 Sep 2025 11:47:04 +0200 Subject: [PATCH] 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. --- .github/workflows/main.yml | 2 +- build_tools/release-notes.sh | 26 +++++++++++++-------- tests/checks/sphinx-markdown-changelog.fish | 12 ++++++---- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0989f1c40..ecee0ad33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/build_tools/release-notes.sh b/build_tools/release-notes.sh index 14154a281..61d93ada3 100755 --- a/build_tools/release-notes.sh +++ b/build_tools/release-notes.sh @@ -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 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 <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"