From 844165f25c1674076a8286d54cfe96d52c33a24e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Mart=C3=ADn=20Bl=C3=A1zquez?= Date: Thu, 10 Oct 2024 15:57:17 +0200 Subject: [PATCH] Update `docs` workflows to use `uv` (#1032) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/codspeed.yml | 8 ++++---- .github/workflows/docs-pr-close.yml | 6 +++--- .github/workflows/docs-pr.yml | 12 ++++-------- .github/workflows/docs.yml | 12 ++++-------- scripts/install_docs_dependencies.sh | 9 +++++++++ 5 files changed, 24 insertions(+), 23 deletions(-) create mode 100755 scripts/install_docs_dependencies.sh diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 12830c9d5d..ba6baa1ea2 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -13,12 +13,12 @@ concurrency: jobs: benchmarks: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.12" # Looks like it's not working very well for other people: @@ -26,7 +26,7 @@ jobs: # cache: "pip" # cache-dependency-path: pyproject.toml - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: cache with: path: ${{ env.pythonLocation }} @@ -37,7 +37,7 @@ jobs: run: ./scripts/install_dependencies.sh - name: Run benchmarks - uses: CodSpeedHQ/action@v2 + uses: CodSpeedHQ/action@v3 with: token: ${{ secrets.CODSPEED_TOKEN }} run: pytest tests/ --codspeed diff --git a/.github/workflows/docs-pr-close.yml b/.github/workflows/docs-pr-close.yml index 4f9a307b8a..71f4e5ff93 100644 --- a/.github/workflows/docs-pr-close.yml +++ b/.github/workflows/docs-pr-close.yml @@ -19,12 +19,12 @@ jobs: fetch-depth: 0 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: "3.11" - name: Install dependencies - run: pip install -e .[docs] + run: ./scripts/install_docs_dependencies.sh - name: Set git credentials run: | diff --git a/.github/workflows/docs-pr.yml b/.github/workflows/docs-pr.yml index 306af85ea4..48c7236a58 100644 --- a/.github/workflows/docs-pr.yml +++ b/.github/workflows/docs-pr.yml @@ -22,15 +22,11 @@ jobs: - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} - # Looks like it's not working very well for other people: - # https://github.com/actions/setup-python/issues/436 - # cache: "pip" - # cache-dependency-path: pyproject.toml + python-version: "3.11" - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: cache with: path: ${{ env.pythonLocation }} @@ -38,7 +34,7 @@ jobs: - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' - run: pip install -e .[docs] + run: ./scripts/install_docs_dependencies.sh - name: Set git credentials run: | diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 374bd7ed4d..dd59a5129d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -24,15 +24,11 @@ jobs: - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} - # Looks like it's not working very well for other people: - # https://github.com/actions/setup-python/issues/436 - # cache: "pip" - # cache-dependency-path: pyproject.toml + python-version: "3.11" - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: cache with: path: ${{ env.pythonLocation }} @@ -40,7 +36,7 @@ jobs: - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' - run: pip install -e .[docs] + run: ./scripts/install_docs_dependencies.sh - name: Check no warnings run: mkdocs build --strict diff --git a/scripts/install_docs_dependencies.sh b/scripts/install_docs_dependencies.sh new file mode 100755 index 0000000000..c768b2295c --- /dev/null +++ b/scripts/install_docs_dependencies.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +python_version=$(python -c "import sys; print(sys.version_info[:2])") + +python -m pip install uv + +uv pip install --system -e ".[docs]"