-
Notifications
You must be signed in to change notification settings - Fork 65
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 workflow for link checking and spelling #58
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
CACHE_NAME=$(pwd)/.pytest-check-links-cache | ||
KNOWN_FAILS="\ | ||
ibm \ | ||
or declarativewidgets | ||
" | ||
|
||
cd _build/html | ||
|
||
|
||
pytest \ | ||
--check-links \ | ||
--check-links-cache \ | ||
--check-links-cache-name $CACHE_NAME \ | ||
--check-links-cache-expire-after 604800 \ | ||
--links-ext html \ | ||
-k "not ($KNOWN_FAILS)" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
echo "checking spelling..." | ||
|
||
cd _build/html | ||
|
||
hunspell \ | ||
-d en-GB,en_US \ | ||
-p ../../.ci_support/dictionary.txt \ | ||
-l \ | ||
-H **/*.html \ | ||
| sort \ | ||
| uniq \ | ||
> check-spelling.txt | ||
|
||
if [ -s "check-spelling.txt" ]; then | ||
echo "::warning ::{misspelled words found in built HTML}" | ||
echo "::warning ::{$(cat check-spelling.txt)}" | ||
exit 1 | ||
else | ||
echo "did not find any misspelled words" | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DeclarativeWidgets | ||
JEP | ||
Jupyter | ||
md | ||
Xeus |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: spelling | ||
|
||
channels: | ||
- conda-forge | ||
|
||
dependencies: | ||
- hunspell-en >=2020.06.01 | ||
- hunspell >=1.7.0,<2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jupyter-book >=0.7.0,<1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pytest-check-links >=0.4.2,<1 | ||
requests_cache >=0.5.2,<1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: Linting | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Restore dependency cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: pip-build-${{ hashFiles('.ci_support/requirements-build.txt') }} | ||
restore-keys: | | ||
pip-build- | ||
pip- | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -U -r .ci_support/requirements-build.txt | ||
|
||
- name: Build the book | ||
run: | | ||
jupyter-book build . | ||
|
||
- name: Upload book | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: _build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow I didn't realize it was so easy to persist artifacts in GHA haha |
||
path: _build | ||
|
||
spelling: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Download book | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: _build | ||
path: _build | ||
|
||
- name: Restore dependency cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: conda-spelling-${{ hashFiles('.ci_support/environment-spelling.yml') }} | ||
restore-keys: | | ||
conda-spelling- | ||
conda- | ||
|
||
- name: Install dependencies | ||
uses: goanpeca/[email protected] | ||
with: | ||
activate-environment: spelling | ||
channel-priority: strict | ||
environment-file: .ci_support/environment-spelling.yml | ||
use-only-tar-bz2: true | ||
|
||
- name: Find misspelled words | ||
shell: bash -l {0} | ||
run: | | ||
bash .ci_support/check_spelling.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the likelihood that this is going to be triggered on a regular basis just because people are using non-standard words in JEPs etc? I'm a bit concerned that this is going to feel like a nagging bot that keeps telling people to slightly change wording that they think is correct. Do you know what I mean? |
||
|
||
links: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Download book | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: _build | ||
path: _build | ||
|
||
- name: Restore link cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: .pytest-check-links-cache.sqlite | ||
key: links-checked-${{ hashFiles('.ci_support/requirements-check-links.txt') }} | ||
restore-keys: | | ||
links-checked- | ||
|
||
- name: Restore dependency cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: pip-check-links-${{ hashFiles('.ci_support/requirements-check-links.txt') }} | ||
restore-keys: | | ||
pip-check-links- | ||
pip- | ||
|
||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -U -r .ci_support/requirements-check-links.txt | ||
|
||
- name: Find broken links | ||
run: | | ||
bash .ci_support/check_links.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another option is that we could use the link checker from Sphinx. Jupyter Book supports users calling it with |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,6 @@ node_modules | |
|
||
# Jupyter Book | ||
_build | ||
|
||
# test cruft | ||
*.sqlite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this here, aside from doing one last check on
master
(which would get a little more visibility... I guess badges would be better!), also ensures all the caches are created in that "context"... PRs can be use it as a fallback withrestore-keys
.