Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/netlify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading