Speed up setup of jobs in GitHub Actions (#12769)

This commit is contained in:
Adam Turner
2024-08-12 00:01:36 +01:00
committed by GitHub
parent 0bfaadf6c9
commit 0c67623ae8
3 changed files with 107 additions and 48 deletions

View File

@@ -14,6 +14,7 @@ concurrency:
env:
FORCE_COLOR: "1"
UV_SYSTEM_PYTHON: "1" # make uv do global installs
jobs:
build:
@@ -27,10 +28,14 @@ jobs:
python-version: "3"
- name: Install graphviz
run: sudo apt-get install graphviz
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[docs]
run: uv pip install .[docs]
- name: Render the documentation
run: >
sphinx-build

View File

@@ -14,6 +14,7 @@ concurrency:
env:
FORCE_COLOR: "1"
UV_SYSTEM_PYTHON: "1" # make uv do global installs
jobs:
# If you update any of these commands, don't forget to update the equivalent
@@ -23,17 +24,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install pip
run: python -m pip install --upgrade pip
- name: Install Ruff
run: |
ruff_version=$(awk -F'[="]' '/\[project\.optional-dependencies\]/ {p=1} /ruff/ {if (p) print $4}' pyproject.toml)
python -m pip install "ruff==${ruff_version}"
run: >
RUFF_VERSION=$(awk -F'[="]' '/\[project\.optional-dependencies\]/ {p=1} /ruff/ {if (p) print $4}' pyproject.toml)
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/ruff/${RUFF_VERSION}/install.sh"
| sh
- name: Lint with Ruff
run: ruff check . --output-format github
@@ -50,10 +47,14 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade "flake8>=6.0"
run: uv pip install --upgrade "flake8>=6.0"
- name: Lint with flake8
run: flake8 .
@@ -66,10 +67,14 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[lint,test]"
run: uv pip install ".[lint,test]"
- name: Type check with mypy
run: mypy
@@ -82,10 +87,14 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade sphinx-lint
run: uv pip install --upgrade sphinx-lint
- name: Lint documentation with sphinx-lint
run: make doclinter
@@ -98,10 +107,14 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade twine build
run: uv pip install --upgrade twine build
- name: Lint with twine
run: |
python -m build .

View File

@@ -36,7 +36,6 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
docutils:
- "0.20"
- "0.21"
@@ -49,12 +48,43 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
if: "!endsWith(matrix.python, '-dev')"
with:
python-version: ${{ matrix.python }}
- name: Check Python version
run: python --version --version
- name: Install graphviz
run: sudo apt-get install graphviz
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: uv pip install .[test]
- name: Install Docutils ${{ matrix.docutils }}
run: uv pip install --upgrade "docutils~=${{ matrix.docutils }}.0"
- name: Test with pytest
run: python -m pytest -vv --durations 25
env:
PYTHONWARNINGS: "error" # treat all warnings as errors
deadsnakes:
runs-on: ubuntu-latest
name: Python ${{ matrix.python }} (Docutils ${{ matrix.docutils }})
strategy:
fail-fast: false
matrix:
python:
- "3.13-dev"
docutils:
- "0.20"
- "0.21"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }} (deadsnakes)
uses: deadsnakes/action@v3.1.0
if: "endsWith(matrix.python, '-dev')"
with:
python-version: ${{ matrix.python }}
- name: Check Python version
@@ -84,10 +114,12 @@ jobs:
python-version: "3"
- name: Check Python version
run: python --version --version
- name: Install uv
run: >
Invoke-WebRequest -Uri "https://astral.sh/uv/install.ps1"
| Invoke-Expression
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
run: uv pip install .[test]
- name: Test with pytest
run: python -m pytest -vv --durations 25
env:
@@ -112,12 +144,16 @@ jobs:
run: python --version --version
- name: Install graphviz
run: sudo apt-get install graphviz
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
run: uv pip install .[test]
- name: Install Docutils' HEAD
run: python -m pip install git+https://repo.or.cz/docutils.git\#subdirectory=docutils
run: uv pip install "docutils @ git+https://repo.or.cz/docutils.git#subdirectory=docutils"
- name: Test with pytest
run: python -m pytest -vv
env:
@@ -140,13 +176,10 @@ jobs:
- name: Install graphviz
run: sudo apt-get install graphviz
- name: Install uv
run: >
curl
--location
--fail
--proto '=https' --tlsv1.2
--silent --show-error
https://astral.sh/uv/install.sh
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: |
@@ -171,10 +204,14 @@ jobs:
python-version: "3"
- name: Check Python version
run: python --version --version
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
run: uv pip install .[test]
- name: Test with pytest
run: python -m pytest -vv --durations 25
env:
@@ -196,10 +233,14 @@ jobs:
run: python --version --version
- name: Install graphviz
run: sudo apt-get install graphviz
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test] pytest-cov
run: uv pip install .[test] pytest-cov
- name: Test with pytest
run: python -m pytest -vv --cov . --cov-append --cov-config pyproject.toml
env: