From 7c85c4887aabed1a2de8d6f2fe9924f270506d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Fri, 7 Jun 2024 18:49:51 +0100 Subject: [PATCH] Update workflows again --- .github/workflows/ci.yaml | 50 +++++++++---------------- .github/workflows/integration_test.yaml | 4 +- .github/workflows/lint.yml | 37 ++++++++++++++---- pyproject.toml | 4 ++ 4 files changed, 53 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 33ca8e381d..d10dd625b3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,51 +15,37 @@ jobs: platform: [ubuntu-latest, windows-latest] python-version: ["3.8", "3.9"] runs-on: ${{ matrix.platform }} - defaults: - run: - shell: bash steps: - uses: actions/checkout@v4 + - name: Install Python tools + uses: BrandonLWhite/pipx-install-action@v0.1.1 - uses: actions/setup-python@v5 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: ${{ matrix.python-version }} + cache: poetry - - name: Install base dependencies - run: | - pip install poetry - poetry install - - - name: Install linux dependencies - if: matrix.platform != 'windows-latest' + - name: Install PyGobject dependencies + if: matrix.platform == 'ubuntu-latest' run: | sudo apt update sudo apt install ffmpeg gobject-introspection libgirepository1.0-dev poetry install --extras replaygain - - name: Test the code + - name: Install Python dependencies + run: poetry install --only=main,test + + - if: ${{ ! (matrix.python-version == env.PYTHON_VERSION && matrix.platform == 'ubuntu-latest') }} + name: Test without coverage + run: poe test --no-cov + + - if: matrix.python-version == env.PYTHON_VERSION && matrix.platform == 'ubuntu-latest' + name: Test with coverage uses: liskin/gh-problem-matcher-wrap@v2 with: linters: pytest - run: poetry run project test + run: poe test - - name: Upload code coverage - if: matrix.python-version == ${{ env.PYTHON_VERSION }} && matrix.platform == 'ubuntu-latest' + - if: matrix.python-version == env.PYTHON_VERSION && matrix.platform == 'ubuntu-latest' + name: Upload code coverage continue-on-error: true run: poetry run codecov - - test-docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - - uses: snok/install-poetry@v1 - - - name: Install docs dependencies - run: poetry install --with=docs - - - uses: sphinx-doc/github-problem-matcher@master - - - name: Build docs - run: poetry run project docs diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index bb234df232..f4a21eace3 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -26,10 +26,10 @@ jobs: - name: Test env: INTEGRATION_TEST: 1 - run: poetry run project test + run: poe test - name: Check external links in docs - run: poetry run project check-docs-links + run: poe check-docs-links - name: Notify on failure if: ${{ failure() }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6d20cad162..421e1add81 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,37 +14,58 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Install Python tools + uses: BrandonLWhite/pipx-install-action@v0.1.1 - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - - uses: snok/install-poetry@v1 + cache: poetry - name: Install dependencies - run: poetry install --with=lint + run: poetry install --only=main,lint - name: Lint code uses: liskin/gh-problem-matcher-wrap@v2 with: linters: flake8, isort - run: | - poetry run isort --check --diff beets beetsplug test - poetry run flake8 . + run: poe lint typing: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Install Python tools + uses: BrandonLWhite/pipx-install-action@v0.1.1 - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - - uses: snok/install-poetry@v1 + cache: poetry - name: Install dependencies - run: poetry install --with=typing + run: poetry install --only=main,typing - name: Type check code uses: liskin/gh-problem-matcher-wrap@v2 continue-on-error: true with: linters: mypy - run: poetry run mypy --show-column-numbers --no-error-summary + run: poe check-types --show-column-numbers --no-error-summary + + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python tools + uses: BrandonLWhite/pipx-install-action@v0.1.1 + - uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: poetry + + - name: Install dependencies + run: poetry install --only=main,docs + + - uses: sphinx-doc/github-problem-matcher@master + name: Build docs + with: + run: poe docs diff --git a/pyproject.toml b/pyproject.toml index 13ba4dc354..0e259f26da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -145,6 +145,10 @@ release = "extra.release:cli" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" +[tool.pipx-install] +poethepoet = ">=0.26" +poetry = ">=1.8" + [tool.poe.tasks.bump] help = "Bump project version and update relevant files" cmd = "release bump $version"