Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs workflow #69

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
push:
paths-ignore:
- .github/workflows/update_pip.yaml
- docs/**
- .readthedocs.yaml
- 'docs/**'
- '.readthedocs.yaml'
- '**/*.md'
pull_request:
paths-ignore:
- .github/workflows/update_pip.yaml
- docs/**
- 'docs/**'
- .readthedocs.yaml
- '**/*.md'

Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: docs

on:
pull_request:
paths:
- '**/CHANGELOG.md'
- 'docs/**'
- '.github/workflows/docs.yaml'

jobs:
check-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- uses: actions/[email protected]
with:
python-version: '3.11'

- name: Create virtualenv
run: python3 -m venv .venv

- name: Install dependencies
run: |
source .venv/bin/activate
python -m pip install .
python -m pip install -r docs/requirements.txt

- name: Linkcheck
working-directory: docs
run: |
source ../.venv/bin/activate

set +e
make linkcheck
exit_code=$?

set -e

if [ $exit_code -eq 0 ]; then
echo -e "\n\n=================\nAll links are valid!"

echo "# :heavy_check_mark: Sphinx links" >> $GITHUB_STEP_SUMMARY
echo "All links are valid!" >> $GITHUB_STEP_SUMMARY
else
echo -e "\n\n=================\nFound broken links. Look at the build logs.\n"

echo "# :x: Sphinx links" >> $GITHUB_STEP_SUMMARY
echo "Found broken links. Look at the build logs for additional information." >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat build/linkcheck/output.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi

exit $exit_code

check-warnings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- uses: actions/[email protected]
with:
python-version: '3.11'

- name: Create virtualenv
run: python3 -m venv .venv

- name: Install dependencies
run: |
source .venv/bin/activate
python -m pip install .
python -m pip install -r docs/requirements.txt

- name: Check warnings/errors
working-directory: docs
run: |
source ../.venv/bin/activate

set +e
make htmlstrict

exit_code=$?

set -e

if [ $exit_code -eq 0 ]; then
echo -e "\n\n=================\nNo warnings or errors detected!"
echo "# :heavy_check_mark: Sphinx warnings/errors" >> $GITHUB_STEP_SUMMARY
echo "No errors or warnings detected!" >> $GITHUB_STEP_SUMMARY
else
echo -e "\n\n=================\nWarnings and or errors detected; See the summary bellow:\n"
cat build/htmlstrict/output.txt

echo "# :x: Sphinx warnings/errors" >> $GITHUB_STEP_SUMMARY
echo "Found some warnings or errors:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat build/htmlstrict/output.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi

exit $exit_code
10 changes: 8 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ BUILDDIR = build
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile
.PHONY: help Makefile htmlstrict

livehtml:
sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: htmlstrict
htmlstrict:
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" -W --keep-going -w $(BUILDDIR)/htmlstrict/output.txt
@echo
@echo "Warnings check complete."
Empty file added docs/source/_static/.gitignore
Empty file.
Loading