Update workflows

This commit is contained in:
Šarūnas Nejus 2024-06-05 20:23:47 +01:00
parent bfd9753314
commit 4a8e6e961f
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435
7 changed files with 113 additions and 156 deletions

View file

@ -1,16 +0,0 @@
{
"problemMatcher": [
{
"owner": "flake8",
"pattern": [
{
"regexp": "^(.*?):(\\d+):(\\d+): (.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
]
}
]
}

View file

@ -1,18 +0,0 @@
{
"problemMatcher": [
{
"owner": "sphinx",
"pattern": [
{
"regexp": "^Warning, treated as error:$"
},
{
"regexp": "^(.*?):(\\d+):(.*)$",
"file": 1,
"line": 2,
"message": 3
}
]
}
]
}

View file

@ -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

View file

@ -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

View file

@ -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() }}

71
.github/workflows/lint.yml vendored Normal file
View file

@ -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

View file

@ -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