Skip to content

DOBPlugin: Implementation and tests #458

DOBPlugin: Implementation and tests

DOBPlugin: Implementation and tests #458

name: build
on:
push:
branches: [ master, feat/python_3.10_support ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
virtualenvs-in-project: false
installer-parallel: false
- name: Install dependencies
run: |
python -m pip install coverage black mypy pytest types-pytz types-requests
if [ -f pyproject.toml ]; then poetry config installer.modern-installation false; poetry run pip install 'setuptools==57.5.0'; poetry install --no-root; fi
- name: Lint with black and static type check with mypy
run: |
# stop the build if there are Python syntax errors or undefined names
black .
mypy dialogy --install-types
- name: Test with pytest and get Coverage
run: |
poetry run pytest --cov=dialogy --cov-report=xml tests/
coverage report | tee cov.out
echo "covpercentage=$(cat cov.out | tail -n1 | awk -F ' ' '{print $4}' | sed 's/.$//')" >> "$GITHUB_ENV"
- name: Upload coverage data to coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
verbose: true
- name: Check if coverage less than 85%
if: env.covpercentage < '85'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Code Coverage is less than 85%')