-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.31 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
working-directory: ./
run: poetry run flake8 mind_renderer/
- name: Run isort and black
working-directory: ./
run: poetry run isort . && poetry run black .
- name: Run Pytest with coverage
run: poetry run pytest -vv --cov=mind_renderer --cov-config=pyproject.toml -vv tests
- 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