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 link caching #8354

Merged
merged 1 commit into from May 6, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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