Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workflow with poetry #70

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
name: Code quality
on: [push, pull_request]
on: [push, pull_request_target]
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -10,40 +9,46 @@ jobs:
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@v3
- uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Generate requirements.txt
run: ./generate_requirements

- name: Install poetry
run: pipx install poetry

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
cache: poetry

- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install beets==${{ matrix.beets }}
pip install coveralls
pip install -e .
poetry install

- name: Pytest
run: pytest -k 'not need_connection' --ignore-glob='*test_lib*'
run: poetry run pytest -k 'not need_connection' --ignore-glob='*test_lib*'

- name: Upload coverage data to coveralls.io
run: coveralls --service=github
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: flake8 . --output-file flake.log --exit-zero
run: poetry run flake8 . --output-file flake.log --exit-zero

- name: Lint mypy
run: mypy > mypy.log || true
run: poetry run mypy > mypy.log || true

- name: Lint pylint
run: pylint --output pylint.log --exit-zero $(git ls-files '*.py')
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
Expand All @@ -58,6 +63,7 @@ jobs:
-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
Expand All @@ -67,6 +73,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

coveralls:
if: ${{ always() }}
name: Indicate completion to coveralls.io
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Unreleased

### Updated

- CI: Use `poetry` in the build workflow.
- CI: Use `pull_request_target` trigger to make sure secrets are passed to runs in forks.

## [0.19.2] 2024-08-04

### Fixed
Expand Down
15 changes: 0 additions & 15 deletions generate_requirements

This file was deleted.

Loading