Update config #10
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: Run Tests and Linting | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.5.1 | |
- name: Install dependencies | |
run: poetry install | |
- name: Run Flake8 | |
run: poetry run flake8 mind_renderer/ | |
- name: Run isort | |
run: poetry run isort --check-only --diff . | |
- name: Run Black | |
run: poetry run black --check --diff . | |
- name: Run Pytest with coverage | |
run: poetry run pytest -vv --cov=mind_renderer --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
- name: Check coverage threshold | |
run: | | |
coverage_percentage=$(poetry run coverage report | grep TOTAL | awk '{print $4}' | sed 's/%//') | |
if (( $(echo "$coverage_percentage < 80" | bc -l) )); then | |
echo "Coverage is below 80%. Current coverage: $coverage_percentage%" | |
exit 1 | |
fi |