diff --git a/.github/flake8-problem-matcher.json b/.github/flake8-problem-matcher.json deleted file mode 100644 index 52f94e05e..000000000 --- a/.github/flake8-problem-matcher.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "problemMatcher": [ - { - "owner": "flake8", - "pattern": [ - { - "regexp": "^(.*?):(\\d+):(\\d+): (.*)$", - "file": 1, - "line": 2, - "column": 3, - "message": 4 - } - ] - } - ] -} diff --git a/.github/sphinx-problem-matcher.json b/.github/sphinx-problem-matcher.json deleted file mode 100644 index d33eb09b6..000000000 --- a/.github/sphinx-problem-matcher.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "problemMatcher": [ - { - "owner": "sphinx", - "pattern": [ - { - "regexp": "^Warning, treated as error:$" - }, - { - "regexp": "^(.*?):(\\d+):(.*)$", - "file": 1, - "line": 2, - "message": 3 - } - ] - } - ] -} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 46ab2b203..d4bebcddf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,108 +1,52 @@ -name: ci +name: Test on: + pull_request: push: branches: - master - pull_request: - branches: - - master +env: + PYTHON_VERSION: 3.8 + PY_COLORS: 1 + jobs: test: - runs-on: ${{ matrix.platform }} + name: Run tests strategy: matrix: platform: [ubuntu-latest, windows-latest] - python-version: ["3.8", "3.9", "3.x"] - - env: - PY_COLORS: 1 - + python-version: ["3.8", "3.9"] + runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v4 - - - name: Install Poetry - run: pipx install poetry - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Install Python tools + uses: BrandonLWhite/pipx-install-action@v0.1.1 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: poetry - - name: Install base dependencies - run: poetry install - - - name: Install optional dependencies - if: matrix.platform != 'windows-latest' + - name: Install PyGobject dependencies + if: matrix.platform == 'ubuntu-latest' run: | sudo apt update - sudo apt install ffmpeg + sudo apt install ffmpeg gobject-introspection libgirepository1.0-dev poetry install --extras replaygain - - name: Test older Python versions - if: matrix.python-version != '3.x' - run: poetry run project test + - name: Install Python dependencies + run: poetry install --only=main,test - - name: Upload code coverage - if: matrix.python-version == '3.8' && matrix.platform == 'ubuntu-latest' - continue-on-error: true - run: codecov + - if: ${{ ! (matrix.python-version == env.PYTHON_VERSION && matrix.platform == 'ubuntu-latest') }} + name: Test without coverage + run: poe test --no-cov - - name: Check types - if: matrix.python-version == '3.x' - # continue-on-error is not ideal since it doesn't give a visible - # warning, but there doesn't seem to be anything better: - # https://github.com/actions/toolkit/issues/399 - continue-on-error: true - run: poetry run project check-types - - test-docs: - runs-on: ubuntu-latest - - env: - PY_COLORS: 1 - - steps: - - uses: actions/checkout@v4 - - - name: Install Poetry - run: pipx install poetry - - - name: Set up Python 3.x - uses: actions/setup-python@v5 + - if: matrix.python-version == env.PYTHON_VERSION && matrix.platform == 'ubuntu-latest' + name: Test with coverage + uses: liskin/gh-problem-matcher-wrap@v3 with: - python-version: "3.x" - cache: poetry + linters: pytest + run: poe test - - name: Install base dependencies - run: poetry install - - - name: Add problem matcher - run: echo "::add-matcher::.github/sphinx-problem-matcher.json" - - - name: Build and check docs - run: poetry run project docs - - lint: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install Poetry - run: pipx install poetry - - - name: Set up Python 3.x - uses: actions/setup-python@v5 - with: - python-version: "3.x" - cache: poetry - - - name: Install base dependencies - run: poetry install - - - name: Add problem matcher - run: echo "::add-matcher::.github/flake8-problem-matcher.json" - - - name: Lint with flake8 - run: poetry run project lint + - if: matrix.python-version == env.PYTHON_VERSION && matrix.platform == 'ubuntu-latest' + name: Upload code coverage + continue-on-error: true + run: poetry run codecov diff --git a/.github/workflows/formatting_check.yml b/.github/workflows/formatting_check.yml deleted file mode 100644 index fda4890d1..000000000 --- a/.github/workflows/formatting_check.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: formatting_check -run-name: Check code formatting -on: [push, pull_request] -jobs: - formatting_check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Poetry - run: pipx install poetry - - - name: Set up Python 3.x - uses: actions/setup-python@v5 - with: - python-version: 3.8 - cache: poetry - - - name: Install dependencies - run: poetry install - - - name: Run formatting check - run: poetry run project check-format diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index bb234df23..88945bb8e 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -6,30 +6,25 @@ on: jobs: test_integration: runs-on: ubuntu-latest - - env: - PY_COLORS: 1 - steps: - - uses: actions/checkout@v2 - - - name: Set up latest Python version - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - name: Install Python tools + uses: BrandonLWhite/pipx-install-action@v0.1.1 + - uses: actions/setup-python@v5 with: - python-version: 3.9-dev + python-version: 3.8 + cache: poetry - name: Install dependencies - run: | - pip install poetry - poetry install + run: poetry install - 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 new file mode 100644 index 000000000..55abb22c2 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,71 @@ +name: Lint check +run-name: Lint code +on: + pull_request: + push: + branches: + - master + +env: + PYTHON_VERSION: 3.8 + +jobs: + lint: + 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,lint + + - name: Lint code + uses: liskin/gh-problem-matcher-wrap@v3 + with: + linters: flake8, isort + 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 }} + cache: poetry + + - name: Install dependencies + run: poetry install --only=main,typing + + - name: Type check code + uses: liskin/gh-problem-matcher-wrap@v3 + continue-on-error: true + with: + linters: mypy + 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 22adff8ad..5bb25e104 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -146,6 +146,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" + # We use a default path '.' to make black and isort behave like flake8 and # mypy do: they act on the entire codebase (flake8 does it by default, and # mypy follows our configuration) by default. Positional command-line arguments