-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (45 loc) · 1.78 KB
/
pytest-action.yaml
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
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