diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 87eee0895d..79a32523e5 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -3,7 +3,38 @@ name: Test Rich module on: [pull_request] jobs: + quality: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install uv + uses: astral-sh/setup-uv@v6 + - name: Install dependencies + run: uv pip install --system -e . --group dev + - name: Format check with black + run: python -m black --check . + - name: Typecheck with mypy + run: python -m mypy -p rich --no-incremental + - name: Test with pytest (with coverage) + run: python -m pytest tests -v --cov=./rich --cov-report=xml:./coverage.xml --cov-report term-missing + - name: Upload code coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + name: rich + flags: unittests + env_vars: OS,PYTHON + build: + needs: quality runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -12,6 +43,7 @@ jobs: python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] exclude: - { os: windows-latest, python-version: "3.13" } + - { os: ubuntu-latest, python-version: "3.11" } defaults: run: shell: bash @@ -22,32 +54,9 @@ jobs: with: python-version: ${{ matrix.python-version }} allow-prereleases: true - - name: Install and configure Poetry - # TODO: workaround for https://github.com/snok/install-poetry/issues/94 - uses: snok/install-poetry@v1.3.4 - with: - version: 1.3.1 - virtualenvs-in-project: true + - name: Install uv + uses: astral-sh/setup-uv@v6 - name: Install dependencies - run: poetry install - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - - name: Format check with black - run: | - source $VENV - make format-check - - name: Typecheck with mypy - run: | - source $VENV - make typecheck - - name: Test with pytest (with coverage) - run: | - source $VENV - pytest tests -v --cov=./rich --cov-report=xml:./coverage.xml --cov-report term-missing - - name: Upload code coverage - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage.xml - name: rich - flags: unittests - env_vars: OS,PYTHON + run: uv pip install --system -e . --group test + - name: Test with pytest + run: python -m pytest tests -v diff --git a/pyproject.toml b/pyproject.toml index bc699a0b7c..c166afd628 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,19 @@ attrs = "^21.4.0" pre-commit = "^2.17.0" typing-extensions = ">=4.0.0, <5.0" +[dependency-groups] +test = [ + "pytest>=7.0.0,<8.0.0", + "attrs>=21.4.0,<22.0.0", +] +dev = [ + { include-group = "test" }, + "black>=22.6,<23.0", + "mypy>=1.11,<2.0", + "pytest-cov>=3.0.0,<4.0.0", + "typing-extensions>=4.0.0,<5.0", +] + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api"