diff --git a/.github/workflows/netlify-build.yml b/.github/workflows/netlify-build.yml index 30e610e66db..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 @@ -47,9 +51,7 @@ jobs: # 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 @@ -79,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..2ba04831d9a 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(