diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index cb39c58..0bc0df0 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -1,76 +1,41 @@ name: Python CI -run-name: Python build and test + on: pull_request: - branches: - - main - types: - - opened - - synchronize - - closed + push: + branches: [main] + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read jobs: lint: - name: Ruff lint + name: Lint runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v7 - - - name: Set up Python - uses: actions/setup-python@v7 - with: - python-version: '3.11' - - - uses: astral-sh/ruff-action@v3 - with: - version: "latest" - - - name: Ruff lint - run: ruff check . - - - name: Ruff fmt - run: ruff format . + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v7 + - run: uvx ruff check . + - run: uvx ruff format --check . test: - name: Python tests + name: Test runs-on: ubuntu-latest - needs: lint - steps: - - name: Checkout repository - uses: actions/checkout@v7 - - - name: Set up uv - uses: astral-sh/setup-uv@v7 - - - name: uv sync - run: uv sync - - - uses: extractions/setup-just@v4 - - - name: Run tests - run: | - source .venv/bin/activate - just test + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v7 + - run: uv sync + - run: uv run pytest -v build: name: Build runs-on: ubuntu-latest needs: [lint, test] - steps: - - name: Checkout repository - uses: actions/checkout@v7 - - - name: Set up uv - uses: astral-sh/setup-uv@v7 - - - name: uv sync - run: uv sync - - - name: Get CLI version - run: | - source .venv/bin/activate - github-rest-cli --version + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v7 + - run: uv build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 102255c..b9a5c21 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,3 +6,9 @@ repos: - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.22 + hooks: + - id: ruff-check + args: [--fix] + - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index 13049b1..42592c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ allow-direct-references = true [tool.ruff] lint.extend-select = ["C4", "SIM", "TCH", "T20"] show-fixes = true -target-version = "py37" +target-version = "py311" [tool.ruff.lint.isort] case-sensitive = true diff --git a/tests/test_cli_dependabot.py b/tests/test_cli_dependabot.py index 969863c..6959a87 100644 --- a/tests/test_cli_dependabot.py +++ b/tests/test_cli_dependabot.py @@ -45,9 +45,7 @@ def test_dependabot_both_flags_error(capsys): parser = build_parser() with pytest.raises(SystemExit) as exc_info: - parser.parse_args( - ["dependabot", "--name", "my-repo", "--enable", "--disable"] - ) + parser.parse_args(["dependabot", "--name", "my-repo", "--enable", "--disable"]) assert exc_info.value.code == 2 err = capsys.readouterr().err