From 3916ecd7f824c6a9140010da12da7bab55b6c342 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 23 Apr 2026 16:04:53 +0100 Subject: [PATCH 1/5] ci: debug lychee cache --- .github/workflows/netlify-build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/netlify-build.yml b/.github/workflows/netlify-build.yml index 30e610e66db..4bc04cf292b 100644 --- a/.github/workflows/netlify-build.yml +++ b/.github/workflows/netlify-build.yml @@ -45,6 +45,11 @@ jobs: key: lychee-${{ github.run_id }} restore-keys: lychee- + - name: Upload lychee cache for inspection + uses: actions/upload-artifact@v7 + with: + name: lychee-cache + # This builds the book in target/guide/. - name: Build the guide run: | From f7f9062bd62fb455dff58e09644ef9a0ad8f58f8 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 23 Apr 2026 16:19:31 +0100 Subject: [PATCH 2/5] add path --- .github/workflows/netlify-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/netlify-build.yml b/.github/workflows/netlify-build.yml index 4bc04cf292b..4f17e044fa2 100644 --- a/.github/workflows/netlify-build.yml +++ b/.github/workflows/netlify-build.yml @@ -49,6 +49,7 @@ jobs: uses: actions/upload-artifact@v7 with: name: lychee-cache + path: .lycheecache # This builds the book in target/guide/. - name: Build the guide From 91d6d1e8a8332cc37b66f754def4edb8c5ef04e0 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 23 Apr 2026 16:40:09 +0100 Subject: [PATCH 3/5] include hidden files --- .github/workflows/netlify-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/netlify-build.yml b/.github/workflows/netlify-build.yml index 4f17e044fa2..94a0f1d9338 100644 --- a/.github/workflows/netlify-build.yml +++ b/.github/workflows/netlify-build.yml @@ -50,6 +50,7 @@ jobs: with: name: lychee-cache path: .lycheecache + include-hidden-files: true # This builds the book in target/guide/. - name: Build the guide From e63772a30eff2e30c1fa7ff221b5370f4cd6d65b Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 23 Apr 2026 17:06:57 +0100 Subject: [PATCH 4/5] attempt to prune empty cache entries --- .github/workflows/netlify-build.yml | 23 ++++++++--------------- noxfile.py | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/netlify-build.yml b/.github/workflows/netlify-build.yml index 94a0f1d9338..7d18be35790 100644 --- a/.github/workflows/netlify-build.yml +++ b/.github/workflows/netlify-build.yml @@ -14,15 +14,19 @@ concurrency: env: CARGO_TERM_COLOR: always + NOX_DEFAULT_VENV_BACKEND: uv + UV_PYTHON: "3.14" jobs: guide-build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6.0.2 - - uses: actions/setup-python@v6 + - uses: astral-sh/setup-uv@v7 with: - python-version: "3.14" + # codspeed action needs to be run from within the final Python environment + activate-environment: true + save-cache: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }} - uses: dtolnay/rust-toolchain@nightly @@ -45,18 +49,9 @@ jobs: key: lychee-${{ github.run_id }} restore-keys: lychee- - - name: Upload lychee cache for inspection - uses: actions/upload-artifact@v7 - with: - name: lychee-cache - path: .lycheecache - include-hidden-files: true - # This builds the book in target/guide/. - name: Build the guide - run: | - python -m pip install --upgrade pip && pip install nox[uv] - nox -s ${{ github.event_name == 'release' && 'build-guide' || 'check-guide' }} + run: uvx nox -s ${{ github.event_name == 'release' && 'build-guide' || 'check-guide' }} env: PYO3_VERSION_TAG: ${{ github.event_name == 'release' && steps.prepare_tag.outputs.tag_name || 'main' }} # allows lychee to get better rate limits from github @@ -86,9 +81,7 @@ jobs: echo "PYO3_VERSION=${PYO3_VERSION}" >> $GITHUB_ENV - name: Build the site - run: | - python -m pip install --upgrade pip && pip install nox[uv] towncrier requests - nox -s build-netlify-site -- ${{ (github.ref != 'refs/heads/main' && '--preview') || '' }} + run: uvx --with requests nox -s build-netlify-site -- ${{ (github.ref != 'refs/heads/main' && '--preview') || '' }} # Upload the built site as an artifact for deploy workflow to consume - name: Upload Build Artifact diff --git a/noxfile.py b/noxfile.py index 64be1c48f50..0876ec33e66 100644 --- a/noxfile.py +++ b/noxfile.py @@ -776,6 +776,24 @@ def check_guide(session: nox.Session): *session.posargs, ) + # We prune connection errors from the cache so that flaky / down sites will be retried + # without just causing PRs to fail until the cache expires + cache_path = Path(".lycheecache") + + # Cache is a simple CSV of url, status, timestamp; filter out entries without a status code. + # (we also have --cache-exclude-status set above) + # see also https://github.com/lycheeverse/lychee/issues/2156 for context + if cache_path.exists(): + lines = cache_path.read_text().splitlines() + new_lines = [] + for line in lines: + url, status, timestamp = line.split(",", 2) + if not status: + session.log(f"Pruning lychee cache entry for {url} with empty status") + continue + new_lines.append(line) + cache_path.write_text("\n".join(new_lines) + "\n") + try: # check all links in the guide _run( From 6729f61a3c973c622d19646c895c98ca90b8803f Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 23 Apr 2026 17:31:37 +0100 Subject: [PATCH 5/5] fix incorrect indentation --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 0876ec33e66..2ba04831d9a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -791,7 +791,7 @@ def check_guide(session: nox.Session): if not status: session.log(f"Pruning lychee cache entry for {url} with empty status") continue - new_lines.append(line) + new_lines.append(line) cache_path.write_text("\n".join(new_lines) + "\n") try: