Skip to content

Commit

Permalink
Merge pull request #8377 from blink1073/cache-docs-1.2.x
Browse files Browse the repository at this point in the history
[1.2.x] Add Link Caching
  • Loading branch information
Steven Silvester committed May 6, 2020
2 parents 2dc3ace + aaaa2b3 commit 220e420
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/linuxtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ jobs:
name: Linux
strategy:
matrix:
group: [integrity, docs, docs2, python, usage, nonode]
group: [integrity, docs, python, usage, nonode]
python: [3.5, 3.8]
exclude:
- group: integrity
python: 3.5
- group: docs
python: 3.5
fail-fast: false
timeout-minutes: 90
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -56,6 +57,15 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache checked links build
uses: actions/cache@v1
if: ${{ matrix.group == 'docs' }}
with:
path: ~/.cache/pytest-link-check
key: ${{ runner.os }}-link-check-${{ hashFiles('**/*.rst') }}
restore-keys: |
${{ runner.os }}-link-check-
- name: Install dependencies
env:
GROUP: ${{ matrix.group }}
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ sphinx-copybutton
sphinx_rtd_theme
recommonmark
pytest
pytest-check-links
pytest-check-links[cache]>=0.4.2
jsx-lexer
32 changes: 13 additions & 19 deletions scripts/ci_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,28 @@ fi


if [[ $GROUP == docs ]]; then
# Verify tutorial docs build
# Build the tutorial docs
pushd docs
pip install sphinx sphinx-copybutton sphinx_rtd_theme recommonmark jsx-lexer
pip install -r ./requirements.txt
make html

# Changelog has a lot of links and is covered in a separate job.
# Also ignore internal sphinx files
changelog=build/html/getting_started/changelog.html
genindex=build/html/genindex.html
search=build/html/search.html
deselect="--deselect $changelog --deselect $genindex --deselect $search"
py.test --check-links -k .html $deselect build/html || py.test --check-links -k .html $deselect --lf build/html

popd
fi


if [[ $GROUP == docs2 ]]; then
# Run the link check on md files - allow for a link to fail once (--lf means only run last failed)
py.test --check-links -k .md . || py.test --check-links -k .md --lf .
# Run the link check on the built html files
CACHE_DIR="${HOME}/.cache/pytest-link-check"
mkdir -p ${CACHE_DIR}
echo "Existing cache:"
ls -ltr ${CACHE_DIR}
args="--check-links --check-links-cache --check-links-cache-expire-after 86400 --check-links-cache-name ${CACHE_DIR}/cache"
args="--ignore docs/build/html/genindex.html --ignore docs/build/html/search.html ${args}"
py.test $args --links-ext .html -k .html docs/build/html || py.test $args --links-ext .html -k .html --lf docs/build/html

# Build the API docs
jlpm build:packages
jlpm docs

# Run the link check on the changelog - allow for a link to fail once (--lf means only run last failed)
changelog=./docs/source/getting_started/changelog.rst
py.test --check-links $changlog || py.test --check-links --lf $changelog
# Run the link check on md files - allow for a link to fail once (--lf means only run last failed)
args="--check-links --check-links-cache --check-links-cache-expire-after 86400 --check-links-cache-name ${CACHE_DIR}/cache"
py.test $args --links-ext .md -k .md . || py.test $args --links-ext .md -k .md --lf .
fi


Expand Down

0 comments on commit 220e420

Please sign in to comment.