[pre-commit.ci] pre-commit autoupdate #380
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: QA | |
on: [ push, pull_request, workflow_dispatch ] | |
jobs: | |
poetry: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
python-version: [ 3.12 ] | |
runs-on: ${{ matrix.os }} | |
name: Mypy + Pytest - ${{ matrix.os }} - Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install project (if cache does not exist) | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction | |
- name: Check code statically with Mypy | |
uses: tsuyoshicho/action-mypy@v4 | |
with: | |
reporter: github-pr-review | |
level: warning | |
execute_command: 'poetry run mypy --strict --enable-incomplete-feature=NewGenericSyntax digimon_card_game tests' | |
- name: Test with pytest | |
run: poetry run pytest --cov --cov-report=xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: ./coverage.xml | |
ruff: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
runs-on: ${{ matrix.os }} | |
name: Ruff - ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Lint code with Ruff | |
uses: chartboost/ruff-action@v1 | |
with: | |
args: check . --fix --config pyproject.toml | |
version: 0.5.4 | |
- name: Git Auto Commit | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: ':rotating_light: Lint issues fixed by Ruff CI' | |
black: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
runs-on: ${{ matrix.os }} | |
name: Black - ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Enforce code style with Black | |
uses: psf/black@stable | |
radon: | |
# Container action is only supported on Linux | |
runs-on: ubuntu-latest | |
name: Radon - ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Analyze code complexity with Radon | |
# Version cannot be set to v1 | |
uses: davidslusser/actions_python_radon@v1.0.0 | |
with: | |
src: . | |
grade: A |