Skip to content

Commit

Permalink
Merge pull request #417 from shunichironomura/simplify-ruff-action
Browse files Browse the repository at this point in the history
Use uv run to run ruff in CI
  • Loading branch information
shunichironomura authored Dec 25, 2024
2 parents 1cc733a + fc0c646 commit 8a7ec69
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Extract Ruff version from pyproject.toml
id: extract-ruff-version
run: |
echo "ruff_version=$(python -c "import tomllib;f=open('pyproject.toml', 'rb');print(next(iter(version.strip() for package, version in (dep.split('==') for dep in tomllib.load(f)['tool']['uv']['dev-dependencies'] if '==' in dep) if package.strip() == 'ruff')));f.close()")" >> "$GITHUB_OUTPUT"
- uses: chartboost/ruff-action@v1
with:
version: ${{ steps.extract-ruff-version.outputs.ruff_version }}

- name: Install ruff
run: uv sync --only-group ruff

- name: Run ruff
run: uv run -- ruff check

mypy:
if: github.event.pull_request.draft == false
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ dev = [
{ include-group = "scripts" },
]

lint = ["ruff==0.8.4", "deptry==0.21.2"]
lint = [{ include-group = "ruff" }, "deptry==0.21.2"]
ruff = ["ruff==0.8.4"]
typing = [
"mypy==1.14.0",
"pytest",
Expand Down
4 changes: 4 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8a7ec69

Please sign in to comment.