Skip to content

Commit

Permalink
Add link caching
Browse files Browse the repository at this point in the history
request the cache version of pytest-check-links

clean up packages

Revert "clean up packages"

This reverts commit dc193e7.

Fix ci script

build api docs after link checks

cache action must target directory

break link check into two build and add hashing

Ensure the cache dir exists

Install docs requirements

consolidate jobs again

break changelog into its own job

cleanup cache paths and increase test timeout

fix timeout-minutes specifier

try changing cache name and adding restore-keys

try changing cache name and adding restore-keys

Clean up cache handling

Use matrix.group

bump version requirement

We weren't actually using a cache...

Print the contents of the cache dir

change the cache name

consolidate to one build

remove changelog build

update restore-keys
  • Loading branch information
Steven Silvester committed May 5, 2020
1 parent 23d7624 commit d4ea14c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/linuxtests.yml
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Linux
strategy:
matrix:
group: [integrity, integrity2, docs, usage, docs2, python, nonode]
group: [integrity, integrity2, docs, usage, python, nonode]
python: [3.5, 3.8]
exclude:
- group: integrity
Expand All @@ -16,22 +16,21 @@ jobs:
python: 3.5
- group: docs
python: 3.5
- group: docs2
python: 3.5
- group: changelog
python: 3.5
fail-fast: false
timeout-minutes: 90
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}

- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Cache pip on Linux
uses: actions/cache@v1
if: startsWith(runner.os, 'Linux')
Expand All @@ -41,7 +40,6 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python }}
# Cache yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -54,11 +52,21 @@ 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 }}
run: |
bash ./scripts/ci_install.sh
- name: Run test ${{ matrix.group }}
env:
GROUP: ${{ matrix.group }}
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Expand Up @@ -3,5 +3,5 @@ sphinx-copybutton
sphinx_rtd_theme
recommonmark
pytest
pytest-check-links
pytest-check-links[cache]>=0.4.1
jsx-lexer
30 changes: 12 additions & 18 deletions scripts/ci_script.sh
Expand Up @@ -37,34 +37,28 @@ fi


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

# Remove internal sphinx files and use pytest-check-links on the generated html
rm build/html/genindex.html
rm build/html/search.html

# Changelog has a lot of links and is covered in a separate job.
changelog_html=./build/html/getting_started/changelog.html
py.test --check-links --links-ext .html -k .html --ignore $changelog_html build/html || py.test --check-links --links-ext .html -k .html --ignore $changelog_html --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 --links-ext .md -k .md . || py.test --check-links --links-ext .md -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 $changelog || 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 d4ea14c

Please sign in to comment.