Skip to content

Commit

Permalink
add test files
Browse files Browse the repository at this point in the history
Add some files that we can use to test the functionality.

Signed-off-by: Ruth Fuchss <[email protected]>
  • Loading branch information
ru-fu committed Aug 6, 2024
1 parent 1348f46 commit 15d7ceb
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test-starter-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions sp-tests/add-files-and-build.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions sp-tests/testfiles/test-md.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
discourse: 42771
relatedlinks: https://github.com/canonical/sphinx-docs-starter-pack
---

# Markdown test
5 changes: 5 additions & 0 deletions sp-tests/testfiles/test-rst.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:discourse: 42771
:relatedlinks: https://github.com/canonical/sphinx-docs-starter-pack

reST test
=========

0 comments on commit 15d7ceb

Please sign in to comment.