Skip to content

Commit

Permalink
add regression test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnabil committed Feb 29, 2024
1 parent 0a75399 commit 0ed03a6
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/regression.yml
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

0 comments on commit 0ed03a6

Please sign in to comment.