Merge pull request #3 from DataScience-LMU/move-tests #28
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: Python Package Check | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
- name: Install project | |
run: poetry install --no-interaction | |
- name: Install dependencies | |
run: | | |
source .venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install flake8 mypy pydocstyle coverage | |
- name: Run unittests | |
run: | | |
source .venv/bin/activate | |
coverage run -m unittest discover -s tests | |
- name: Generate coverage reports | |
run: | | |
source .venv/bin/activate | |
coverage report -m | |
coverage xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests | |
- name: Run Flake8 | |
run: | | |
source .venv/bin/activate | |
flake8 --max-line-length=88 --ignore=E203,F722,W503 src | |
- name: Run MyPy | |
if: ${{ always() }} | |
run: | | |
source .venv/bin/activate | |
mypy --ignore-missing-imports --scripts-are-modules --follow-imports=skip src | |
- name: Run Pydocstyle | |
if: ${{ always() }} | |
run: | | |
source .venv/bin/activate | |
pydocstyle --ignore-decorators=property src |