Use `astral-sh/ruff-action and astral-sh/setup-uv` in GitHub Actions (#13198)

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
Christian Clauss 2025-01-02 23:27:39 +01:00 committed by GitHub
parent 90d50c1320
commit 3967c7d3ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 67 additions and 69 deletions

View File

@ -31,11 +31,10 @@ jobs:
- name: Install graphviz
run: sudo apt-get install --no-install-recommends --yes graphviz
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[docs]
- name: Render the documentation

View File

@ -35,11 +35,10 @@ jobs:
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
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install build dependencies (pypa/build, twine)
run: |

View File

@ -31,19 +31,17 @@ jobs:
RUFF_VERSION=$(awk -F'[="]' '/\[project\.optional-dependencies\]/ {p=1} /ruff/ {if (p) print $4}' pyproject.toml)
echo "RUFF_VERSION=$RUFF_VERSION" >> $GITHUB_ENV
- name: Install Ruff
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
--write-out "%{stderr}Downloaded: %{url}\n"
"https://astral.sh/ruff/$RUFF_VERSION/install.sh"
| sh
- name: Install Ruff ${{ env.RUFF_VERSION }}
uses: astral-sh/ruff-action@v3
with:
args: --version
version: ${{ env.RUFF_VERSION }}
- name: Lint with Ruff
run: ruff check . --output-format github
run: ruff check --output-format=github
- name: Format with Ruff
run: ruff format . --diff
run: ruff format --diff
mypy:
runs-on: ubuntu-latest
@ -57,11 +55,10 @@ jobs:
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
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install ".[lint,test]"
- name: Type check with mypy
@ -79,11 +76,10 @@ jobs:
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
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install ".[lint,test]"
- name: Type check with pyright
@ -101,11 +97,10 @@ jobs:
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
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install --upgrade sphinx-lint
- name: Lint documentation with sphinx-lint
@ -123,11 +118,10 @@ jobs:
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
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install --upgrade twine build
- name: Lint with twine

View File

@ -58,11 +58,10 @@ jobs:
- name: Install graphviz
run: sudo apt-get install --no-install-recommends --yes graphviz
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test]
- name: Install Docutils ${{ matrix.docutils }}
@ -198,9 +197,10 @@ jobs:
- name: Install graphviz
run: choco install --no-progress graphviz
- name: Install uv
run: >
Invoke-WebRequest -Uri "https://astral.sh/uv/install.ps1"
| Invoke-Expression
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test]
- name: Test with pytest
@ -232,11 +232,10 @@ jobs:
- name: Install graphviz
run: sudo apt-get install --no-install-recommends --yes graphviz
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test]
- name: Install Docutils' HEAD
@ -266,11 +265,10 @@ jobs:
- name: Install graphviz
run: sudo apt-get install --no-install-recommends --yes graphviz
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: |
uv pip install .[test] --resolution lowest-direct
@ -298,11 +296,10 @@ jobs:
- 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
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test]
- name: Test with pytest
@ -330,11 +327,10 @@ jobs:
- name: Install graphviz
run: sudo apt-get install --no-install-recommends --yes graphviz
- name: Install uv
run: >
curl --no-progress-meter --location --fail
--proto '=https' --tlsv1.2
"https://astral.sh/uv/install.sh"
| sh
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install .[test] pytest-cov
- name: Test with pytest

View File

@ -27,8 +27,13 @@ jobs:
mkdir -p /tmp/tx_cli && cd $_
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
shell: bash
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: pip install --upgrade babel jinja2
run: uv pip install --upgrade babel jinja2
- name: Extract translations from source code
run: python utils/babel_runner.py extract
- name: Push translations to transifex.com
@ -58,8 +63,13 @@ jobs:
mkdir -p /tmp/tx_cli && cd $_
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
shell: bash
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: pip install --upgrade babel jinja2
run: uv pip install --upgrade babel jinja2
- name: Extract translations from source code
run: python utils/babel_runner.py extract
- name: Pull translations from transifex.com