From 205590419673f56485617a668dda11c6707e42c4 Mon Sep 17 00:00:00 2001 From: Caspar Nettelbladt Date: Fri, 20 Dec 2024 08:48:22 +0100 Subject: [PATCH] Update CI workflow to use uv and ruff --- .github/workflows/python-app.yml | 39 ++++++++++++++------------------ pyproject.toml | 5 ++++ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 200872c..cfd40d6 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -5,35 +5,30 @@ name: Python application on: push: - branches: [ "master" ] + branches: ["master"] pull_request: - branches: [ "master" ] + branches: ["master"] permissions: contents: read jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest + # https://docs.astral.sh/uv/guides/integration/github/#setting-up-python + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v4 + - name: "Set up Python" + uses: actions/setup-python@v5 + with: + python-version-file: ".python-version" + - name: Install the project + run: uv sync --all-extras --dev + # https://docs.astral.sh/ruff/integrations + - name: Run Ruff + run: uv run ruff check --output-format=github . + - name: Run Format + run: uv run ruff ruff format --diff diff --git a/pyproject.toml b/pyproject.toml index 60a1d36..9d26f97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,11 @@ li = "linear.cli:cli" [tool.pyright] venvPath = ".venv" +[tool.uv] +dev-dependencies = [ + "ruff>=0.8.4", +] + [build-system] requires = ["hatchling"] build-backend = "hatchling.build"