Skip to content

Commit 032d4d3

Browse files
committed
ci: add lychee cache (#5616)
1 parent b4f78c0 commit 032d4d3

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

.github/workflows/netlify-build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ jobs:
3939
TAG_NAME="${GITHUB_REF##*/}"
4040
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
4141
42+
- name: Restore lychee cache
43+
id: restore-cache
44+
uses: actions/cache/restore@v4
45+
with:
46+
path: .lycheecache
47+
key: lychee
48+
4249
# This builds the book in target/guide/.
4350
- name: Build the guide
4451
run: |
@@ -49,6 +56,13 @@ jobs:
4956
# allows lychee to get better rate limits from github
5057
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5158

59+
- name: Save lychee cache
60+
uses: actions/cache/save@v4
61+
if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
62+
with:
63+
path: .lycheecache
64+
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
65+
5266
# We store the versioned guides on GitHub's gh-pages branch for convenience
5367
# (the full gh-pages branch is pulled in the build-netlify-site step)
5468
- name: Deploy the guide

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ coverage.json
2828
netlify_build/
2929
.nox/
3030
.vscode/
31+
.lycheecache

noxfile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,8 @@ def check_guide(session: nox.Session):
737737
str(PYO3_GUIDE_SRC),
738738
*remap_args,
739739
"--accept=200,429",
740+
"--cache",
741+
"--max-cache-age=7d",
740742
*session.posargs,
741743
external=True,
742744
)
@@ -754,6 +756,8 @@ def check_guide(session: nox.Session):
754756
"--accept=200,429",
755757
# reduce the concurrency to avoid rate-limit from `pyo3.rs`
756758
"--max-concurrency=32",
759+
"--cache",
760+
"--max-cache-age=7d",
757761
*session.posargs,
758762
external=True,
759763
)

0 commit comments

Comments
 (0)