Skip to content

Commit

Permalink
Add dev scripts with Poe the Poet
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhad6 committed Jul 12, 2024
1 parent e5fb593 commit 30580b7
Show file tree
Hide file tree
Showing 3 changed files with 574 additions and 281 deletions.
29 changes: 10 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
POETRY_VERSION: "1.8.3"
POETHEPOET_VERSION: "0.27.0"
MAIN_PYTHON_VERSION: "3.9"
PACKAGE_NAME: "paramdb"

Expand All @@ -24,7 +25,9 @@ jobs:
uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry==${{ env.POETRY_VERSION }}
run: |
pipx install poetry==${{ env.POETRY_VERSION }}
pipx inject poetry poethepoet==${{ env.POETHEPOET_VERSION }}
- name: Set up Python with Poetry cache
uses: actions/setup-python@v5
Expand All @@ -35,18 +38,6 @@ jobs:
- name: Install dependencies
run: poetry install --all-extras --without docs

- name: Check formatting (Black)
if: matrix.python_version == env.MAIN_PYTHON_VERSION
run: poetry run black ${{ env.PACKAGE_NAME }} tests --check

- name: Lint (Flake8)
if: matrix.python_version == env.MAIN_PYTHON_VERSION
run: poetry run flake8 ${{ env.PACKAGE_NAME }} tests

- name: Lint (Pylint)
if: matrix.python_version == env.MAIN_PYTHON_VERSION
run: poetry run pylint ${{ env.PACKAGE_NAME }} tests

- name: Mypy cache
if: matrix.python_version == env.MAIN_PYTHON_VERSION
uses: actions/cache@v4
Expand All @@ -56,17 +47,17 @@ jobs:
restore-keys: |
mypy-${{ runner.os }}-python-${{ matrix.python_version }}-
- name: Type check (Mypy)
- name: Lint
if: matrix.python_version == env.MAIN_PYTHON_VERSION
run: poetry run mypy ${{ env.PACKAGE_NAME }} tests
run: poetry lint

- name: Test (Pytest)
- name: Test
if: matrix.python_version != env.MAIN_PYTHON_VERSION
run: poetry run pytest
run: poetry test

- name: Test (Pytest) with coverage
- name: Test with coverage
if: matrix.python_version == env.MAIN_PYTHON_VERSION
run: poetry run pytest --cov=${{ env.PACKAGE_NAME }} --cov-report=xml
run: poetry test --cov=${{ env.PACKAGE_NAME }} --cov-report=xml

- name: Upload coverage reports to Codecov
if: matrix.python_version == env.MAIN_PYTHON_VERSION
Expand Down
Loading

0 comments on commit 30580b7

Please sign in to comment.