Spaces:
Sleeping
Sleeping
rmm
commited on
Commit
·
8e4ef44
1
Parent(s):
d0e6c24
feat: extra CI action that adds coverage reports to PR conversation
Browse files
.github/workflows/python-pycov-onPR.yml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This workflow will install dependencies, create coverage tests and run Pytest Coverage Commentator
|
2 |
+
# For more information see: https://github.com/coroo/pytest-coverage-commentator
|
3 |
+
name: pytest-coverage-in-PR
|
4 |
+
on:
|
5 |
+
pull_request:
|
6 |
+
branches:
|
7 |
+
- '*'
|
8 |
+
jobs:
|
9 |
+
build:
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
permissions:
|
12 |
+
contents: write
|
13 |
+
pull-requests: write
|
14 |
+
steps:
|
15 |
+
- uses: actions/checkout@v4
|
16 |
+
- name: Set up Python 3.10
|
17 |
+
uses: actions/setup-python@v3
|
18 |
+
with:
|
19 |
+
python-version: "3.10"
|
20 |
+
- name: Install dependencies
|
21 |
+
run: |
|
22 |
+
python -m pip install --upgrade pip
|
23 |
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
24 |
+
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
|
25 |
+
|
26 |
+
- name: Build coverage files for mishakav commenter action
|
27 |
+
run: |
|
28 |
+
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=src tests/ | tee pytest-coverage.txt
|
29 |
+
echo "working dir:" && pwd
|
30 |
+
echo "files in cwd:" && ls -ltr
|
31 |
+
|
32 |
+
- name: Pytest coverage comment
|
33 |
+
uses: MishaKav/pytest-coverage-comment@main
|
34 |
+
with:
|
35 |
+
pytest-coverage-path: ./pytest-coverage.txt
|
36 |
+
junitxml-path: ./pytest.xml
|
37 |
+
|
38 |
+
#- name: Comment coverage
|
39 |
+
# uses: coroo/[email protected]
|