Skip to content

Optimize CI workflows with concurrency and caching #2004

Optimize CI workflows with concurrency and caching

Optimize CI workflows with concurrency and caching #2004

Workflow file for this run

name: Ubuntu Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
NOKOGIRI_USE_SYSTEM_LIBRARIES: true # for faster htmlproofer install
jobs:
sphinx-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --frozen
- name: Build
run: |
cd docs
uv run make html SPHINXOPTS="-j auto"
cd ../
- name: Check for unparsed markup
run: |
python3 docs/_scripts/check_unparsed_markup.py docs/_build/html
# Upload performance is awful on the many small files our build generates,
# so it's compressed locally before uploading.
# We archive the html and set it as an artifact prior to checking the links.
# This allows for review should it fail.
- name: Compress site
run: tar -czf html.tar.gz docs/_build/html
- name: Archive site HTML
uses: actions/upload-artifact@v4
with:
name: html
path: html.tar.gz
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
# TODO: Look into why we need to ignore archive/tag/index
- name: Check links
if: success()
run: |
bundle exec htmlproofer --ignore-files "/404/,/2013/,/2014/,/2015/,/2016/,/2017/,/search\/index.html/,/archive\/tag\/index/" --allow-hash-href=true --enforce-https=false --ignore-missing-alt=true --disable-external=true --swap-urls "https\://www.writethedocs.org:,http\://www.writethedocs.org:" docs/_build/html