diff --git a/.github/workflows/netlify-build.yml b/.github/workflows/netlify-build.yml index 7fbcc776666..70524cb8a2d 100644 --- a/.github/workflows/netlify-build.yml +++ b/.github/workflows/netlify-build.yml @@ -39,6 +39,13 @@ jobs: TAG_NAME="${GITHUB_REF##*/}" echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT + - name: Restore lychee cache + id: restore-cache + uses: actions/cache/restore@v4 + with: + path: .lycheecache + key: lychee + # This builds the book in target/guide/. - name: Build the guide run: | @@ -49,6 +56,13 @@ jobs: # allows lychee to get better rate limits from github GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Save lychee cache + uses: actions/cache/save@v4 + if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }} + with: + path: .lycheecache + key: ${{ steps.restore-cache.outputs.cache-primary-key }} + # We store the versioned guides on GitHub's gh-pages branch for convenience # (the full gh-pages branch is pulled in the build-netlify-site step) - name: Deploy the guide diff --git a/.gitignore b/.gitignore index da64603db5f..0cd8815e11d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ coverage.json netlify_build/ .nox/ .vscode/ +.lycheecache diff --git a/noxfile.py b/noxfile.py index bd7bf17e7fc..9fa8188dd27 100644 --- a/noxfile.py +++ b/noxfile.py @@ -738,6 +738,8 @@ def check_guide(session: nox.Session): str(PYO3_GUIDE_SRC), *remap_args, "--accept=200,429", + "--cache", + "--max-cache-age=7d", *session.posargs, external=True, ) @@ -755,6 +757,8 @@ def check_guide(session: nox.Session): "--accept=200,429", # reduce the concurrency to avoid rate-limit from `pyo3.rs` "--max-concurrency=32", + "--cache", + "--max-cache-age=7d", *session.posargs, external=True, )