-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: run tests and check coverage | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout repo content | ||
uses: actions/checkout@v2 # checkout the repository content | ||
|
||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' # install the python version needed | ||
|
||
- name: install python packages | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: run pytest | ||
id: test_step | ||
run: pytest tests | ||
|
||
- name: Fail workflow if tests were failed | ||
if: ${{ steps.test_step.outcome == 'failure' }} | ||
run: exit 1 | ||
|
||
- name: run coverage | ||
id: test_cov_step | ||
run: | | ||
coverage run -m pytest tests | ||
coverage report -m | awk '/TOTAL/ {print ($4 > 70)}' | ||
- name: Fail workflow if test coverage score is below threshold | ||
if: ${{ steps.test_cov_step.outcome == 0 }} | ||
run: exit 1 |