build: use standard poetry workflow #426
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code quality | |
on: [push, pull_request_target] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
beets: ["1.4.9", "1.5.0", "1.6.0"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: poetry | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Pytest | |
run: poetry run pytest -k 'not need_connection' --ignore-glob='*test_lib*' | |
- name: Upload coverage data to coveralls.io | |
run: poetry run coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: python${{ matrix.python }}_beets${{ matrix.beets }} | |
COVERALLS_PARALLEL: true | |
- name: Lint flake8 | |
run: poetry run flake8 . --output-file flake.log --exit-zero | |
- name: Lint mypy | |
run: poetry run mypy > mypy.log || true | |
- name: Lint pylint | |
run: poetry run pylint --output pylint.log --exit-zero $(git ls-files '*.py') | |
- name: Set project version | |
run: echo PROJECT_VERSION="$(git describe --tags | sed 's/-[^-]*$//')" >> $GITHUB_ENV | |
- name: SonarCloud Scan | |
if: ${{ matrix.beets == '1.5.0' && matrix.python == '3.8' }} | |
uses: SonarSource/sonarcloud-github-action@master | |
with: | |
args: > | |
-Dsonar.branch.name=${{ github.ref_name }} | |
-Dsonar.organization=snejus | |
-Dsonar.projectKey=snejus_beetcamp | |
-Dsonar.projectVersion=${{ env.PROJECT_VERSION }} | |
-Dsonar.coverage.exclusions=tests/* | |
-Dsonar.exclusions=tests/* | |
-Dsonar.python.coverage.reportPaths=.reports/coverage.xml | |
-Dsonar.python.flake8.reportPaths=flake.log | |
-Dsonar.python.pylint.reportPaths=pylint.log | |
-Dsonar.python.ruff.reportPaths= | |
-Dsonar.python.mypy.reportPaths=mypy.log | |
-Dsonar.python.version=3.8 | |
-Dsonar.python.xunit.reportPath=.reports/test-report.xml | |
-Dsonar.sources=beetsplug/bandcamp | |
-Dsonar.tests=tests | |
-Dsonar.test.inclusions=tests/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
coveralls: | |
if: ${{ always() }} | |
name: Indicate completion to coveralls.io | |
needs: test | |
runs-on: ubuntu-latest | |
container: python:3-slim | |
steps: | |
- name: Finished | |
run: | | |
pip3 install --upgrade coveralls | |
coveralls --service=github --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |