diff --git a/.github/workflows/test-starter-pack.yml b/.github/workflows/test-starter-pack.yml index 5c7c2c01..1d0602a4 100644 --- a/.github/workflows/test-starter-pack.yml +++ b/.github/workflows/test-starter-pack.yml @@ -13,6 +13,8 @@ jobs: uses: actions/checkout@v4 - name: Run init and build run: sp-tests/run-init-and-build.sh + - name: Add some files, build, and test + run: sp-tests/add-files-and-build.sh - name: Run inclusive language check if: success() || failure() run: sp-tests/check-inclusive-language.sh @@ -40,6 +42,8 @@ jobs: uses: actions/checkout@v4 - name: Run init and build run: sp-tests/run-init-and-build.sh docs + - name: Add some files, build, and test + run: sp-tests/add-files-and-build.sh docs - name: Run inclusive language check if: success() || failure() run: sp-tests/check-inclusive-language.sh docs diff --git a/sp-tests/add-files-and-build.sh b/sp-tests/add-files-and-build.sh new file mode 100755 index 00000000..570ea763 --- /dev/null +++ b/sp-tests/add-files-and-build.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -ex + +source sp-tests/get-installation-directory.sh + +# Copy the test files +cp sp-tests/testfiles/test-md.md testdir/$install_directory/ +cp sp-tests/testfiles/test-rst.rst testdir/$install_directory/ + +# Include the files in the toctree +if ! grep -Fxq " test-md" testdir/$install_directory/index.rst +then + echo " test-md" >> testdir/$install_directory/index.rst + echo " test-rst" >> testdir/$install_directory/index.rst +fi + +# Build the documentation +cd testdir/$install_directory +make html + +# Test the output +if ! grep -Fq "A documentation starter-pack" _build/test-md/index.html || \ + ! grep -Fq "A documentation starter-pack" _build/test-rst/index.html +then + echo "Related links don't work (in RST or Markdown)" + exit 1 +fi + +if ! grep -Fq "Documentation Office Hours" _build/test-md/index.html || \ + ! grep -Fq "Documentation Office Hours" _build/test-rst/index.html +then + echo "Discourse links don't work (in RST or Markdown)" + exit 1 +fi diff --git a/sp-tests/testfiles/test-md.md b/sp-tests/testfiles/test-md.md new file mode 100644 index 00000000..e732a0f0 --- /dev/null +++ b/sp-tests/testfiles/test-md.md @@ -0,0 +1,6 @@ +--- +discourse: 42771 +relatedlinks: https://github.com/canonical/sphinx-docs-starter-pack +--- + +# Markdown test diff --git a/sp-tests/testfiles/test-rst.rst b/sp-tests/testfiles/test-rst.rst new file mode 100644 index 00000000..15efd01f --- /dev/null +++ b/sp-tests/testfiles/test-rst.rst @@ -0,0 +1,5 @@ +:discourse: 42771 +:relatedlinks: https://github.com/canonical/sphinx-docs-starter-pack + +reST test +=========