RDRP-1018 #1936
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 pytest on pull request to develop | |
# runs on every pull request to develop | |
on: | |
pull_request: | |
branches: | |
- develop | |
# runs on version 20.04 of ubuntu | |
jobs: | |
pytest-coverage-comment: | |
runs-on: ubuntu-20.04 | |
steps: | |
# 1) Checkout the code | |
- uses: actions/checkout@v3 | |
# 2) Removing PyDoop from the requirements.txt | |
- name: Remove pydoop requirements.txt | |
shell: bash -l {0} | |
run: | | |
awk '!/pydoop.*/' requirements.txt> temp && mv temp requirements.txt | |
# 3) Set up Python | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
# 4) Install dependencies from requirements.txt | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
# 5) Run pytest to run all tests in the tests folder! | |
- name: Use coverage to run pytest | |
# Specify shell to run the command in | |
working-directory: ${{ github.workspace }} | |
shell: bash -l {0} | |
run: | | |
coverage run --branch --source=./src --omit=src/utils/hdfs_mods.py,src/utils/wrappers.py,src/utils/runlog.py,src/_version.py,src/pipeline.py,src/*_main.py \ | |
-m pytest -ra ./tests --junitxml=junit_result.xml --ignore=tests/test_utils/test_hdfs_mods.py && coverage xml \ | |
-o python_coverage.xml && coverage report -m --fail-under=10 | |
# 6) Get the coverage report in to the pull request comments | |
- name: Pytest coverage comment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
title: Detailed Coverage Report | |
badge-title: Percentage Coverage for this PR | |
pytest-xml-coverage-path: ./python_coverage.xml | |
coverage-path-prefix: src/ | |
junitxml-title: Summary of tests | |
junitxml-path: ./junit_result.xml |