Skip to content

Commit

Permalink
Fix validation (#14)
Browse files Browse the repository at this point in the history
* fix validation of coverage file

* update version 1.1.3
  • Loading branch information
MishaKav authored Jun 24, 2021
1 parent 5037dc0 commit 0fcf661
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/live-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

- name: Pytest coverage comment
id: coverageComment
uses: MishaKav/[email protected].2
uses: MishaKav/[email protected].3
with:
pytest-coverage-path: ./data/pytest-coverage_4.txt
junitxml-path: ./data/pytest_1.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/multiple-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- uses: actions/checkout@v2

- name: Pytest coverage comment
uses: MishaKav/[email protected].2
uses: MishaKav/[email protected].3
with:
multiple-files: |
My Title 1, ./data/pytest-coverage_3.txt, ./data/pytest_1.xml
Expand Down
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ You can add this action to your GitHub workflow for Ubuntu runners (e.g. runs-on

```yaml
- name: Pytest coverage comment
uses: MishaKav/[email protected].2
uses: MishaKav/[email protected].3
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
```
## Inputs
| Name | Required | Default | Description |
| ---------------------- | -------- | ----------------------- | ----------------------------------------------------------------------------------------- |
| `github-token` | ✓ | `${{github.token}}` | An alternative GitHub token, other than the default provided by GitHub Actions runner |
| `pytest-coverage-path` | | `./pytest-coverage.txt` | The location of the txt output of pytest-coverage. Used to generate the comment |
| `title` | | `Coverage Report` | Title for the coverage report. Useful for monorepo projects |
| `badge-title` | | `Coverage` | Title for the badge icon |
| `hide-badge` | | false | Hide badge with percentage |
| `hide-report` | | false | Hide coverage report |
| `junitxml-path` | | '' | The location of the junitxml path |
| `junitxml-title` | | '' | Title for summary for junitxml |
| `create-new-comment` | | false | When false, will update the same comment, otherwise will publish new comment on each run. |
| `multiple-files` | | '' | You can pass array of titles and files to generate single comment with table of results.<br/>Single line should look like `Title, ./path/to/pytest-coverage.txt, ./path/to/pytest.xml`<br/> example:<br/> `My Title 1, ./data/pytest-coverage_3.txt, ./data/pytest_1.xml` |
| Name | Required | Default | Description |
| ---------------------- | -------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `github-token` | ✓ | `${{github.token}}` | An alternative GitHub token, other than the default provided by GitHub Actions runner |
| `pytest-coverage-path` | | `./pytest-coverage.txt` | The location of the txt output of pytest-coverage. Used to generate the comment |
| `title` | | `Coverage Report` | Title for the coverage report. Useful for monorepo projects |
| `badge-title` | | `Coverage` | Title for the badge icon |
| `hide-badge` | | false | Hide badge with percentage |
| `hide-report` | | false | Hide coverage report |
| `junitxml-path` | | '' | The location of the junitxml path |
| `junitxml-title` | | '' | Title for summary for junitxml |
| `create-new-comment` | | false | When false, will update the same comment, otherwise will publish new comment on each run. |
| `multiple-files` | | '' | You can pass array of titles and files to generate single comment with table of results.<br/>Single line should look like `Title, ./path/to/pytest-coverage.txt, ./path/to/pytest.xml`<br/> example:<br/> `My Title 1, ./data/pytest-coverage_3.txt, ./data/pytest_1.xml` |

## Output example

Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
pytest --junitxml=pytest.xml --cov=app tests/ | tee pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/[email protected].2
uses: MishaKav/[email protected].3
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
Expand All @@ -82,7 +82,7 @@ Example GitHub Action workflow that uses coverage percentage as output (see the
```yaml
- name: Pytest coverage comment
id: coverageComment
uses: MishaKav/[email protected].2
uses: MishaKav/[email protected].3
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
Expand All @@ -97,7 +97,7 @@ Example GitHub Action workflow that passes all params to Pytest Coverage Comment

```yaml
- name: Pytest coverage comment
uses: MishaKav/[email protected].2
uses: MishaKav/[email protected].3
with:
pytest-coverage-path: ./path-to-file/pytest-coverage.txt
title: My Coverage Report Title
Expand All @@ -118,7 +118,7 @@ It will generate `pytest-coverage.txt` and `pytest.xml` in `/tmp` directory insi
docker run -v /tmp:/tmp $IMAGE_TAG python3 -m pytest --cov-report=term-missing:skip-covered --junitxml=/tmp/pytest.xml --cov=src tests/ | tee /tmp/pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/[email protected].2
uses: MishaKav/[email protected].3
with:
pytest-coverage-path: /tmp/pytest-coverage.txt
junitxml-path: /tmp/pytest.xml
Expand All @@ -128,7 +128,7 @@ Example GitHub Action workflow that uses multiple files mode (see the [live work

```yaml
- name: Pytest coverage comment
uses: MishaKav/[email protected].2
uses: MishaKav/[email protected].3
with:
multiple-files: |
My Title 1, ./data/pytest-coverage_3.txt, ./data/pytest_1.xml
Expand All @@ -146,7 +146,6 @@ Expanded comment
Multiple Files Mode (can be useful on mono-repo projects)
![Result Multiple Files Mode Example](https://user-images.githubusercontent.com/289035/122121939-ddd0c500-ce34-11eb-8546-89a8a769e065.png)


## Badges colors

![Coverage 0-40](https://img.shields.io/badge/Coverage-20%25-red.svg) [0, 40]
Expand Down
75 changes: 75 additions & 0 deletions data/pytest-coverage_5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
test/test_scdata.py::test_arrow_save
/home/runner/work/ctxbio/ctxbio/ctxbio/scdata.py:154: FutureWarning: 'pyarrow.read_serialized' is deprecated as of 2.0.0 and will be removed in a future version. Use pickle or the pyarrow IPC functionality instead.
self.adata = load_single_cell_data(path=x, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
----- generated xml file: /home/runner/work/ctxbio/ctxbio/test/pytest.xml ------

---------- coverage: platform linux, python 3.7.10-final-0 -----------
Name Stmts Miss Cover
---------------------------------------------------------------------------------------------
/home/runner/work/ctxbio/ctxbio/ctxbio/__init__.py 16 3 81%
/home/runner/work/ctxbio/ctxbio/ctxbio/algorithms.py 170 57 66%
/home/runner/work/ctxbio/ctxbio/ctxbio/cesium.py 95 95 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/cesium3.py 148 119 20%
/home/runner/work/ctxbio/ctxbio/ctxbio/compartments.py 27 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/genes.py 31 1 97%
/home/runner/work/ctxbio/ctxbio/ctxbio/imports.py 36 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/io/__init__.py 1 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/io/downsample_mol_info.py 38 1 97%
/home/runner/work/ctxbio/ctxbio/ctxbio/io/gmt.py 11 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/io/homologene.py 22 10 55%
/home/runner/work/ctxbio/ctxbio/ctxbio/io/mtx.py 11 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/io/scload.py 92 65 29%
/home/runner/work/ctxbio/ctxbio/ctxbio/legacy/__init__.py 0 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/legacy/cite_seq.py 42 42 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/legacy/feature_data.py 16 16 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/legacy/vdj.py 78 78 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/neighbors.py 115 15 87%
/home/runner/work/ctxbio/ctxbio/ctxbio/plot/__init__.py 5 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/plot/legacy.py 107 77 28%
/home/runner/work/ctxbio/ctxbio/ctxbio/plot/plot.py 678 101 85%
/home/runner/work/ctxbio/ctxbio/ctxbio/plot/stacked_barplots.py 135 2 99%
/home/runner/work/ctxbio/ctxbio/ctxbio/plot/utils.py 140 35 75%
/home/runner/work/ctxbio/ctxbio/ctxbio/plot/violin.py 54 6 89%
/home/runner/work/ctxbio/ctxbio/ctxbio/preprocess/__init__.py 0 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/preprocess/ambient.py 140 122 13%
/home/runner/work/ctxbio/ctxbio/ctxbio/preprocess/computations.py 481 145 70%
/home/runner/work/ctxbio/ctxbio/ctxbio/preprocess/params.py 39 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/preprocess/pegasus.py 116 10 91%
/home/runner/work/ctxbio/ctxbio/ctxbio/preprocess/preprocess.py 89 10 89%
/home/runner/work/ctxbio/ctxbio/ctxbio/preprocess/scvi_wrapper.py 138 25 82%
/home/runner/work/ctxbio/ctxbio/ctxbio/preprocess/seurat_v3_hvg.py 97 17 82%
/home/runner/work/ctxbio/ctxbio/ctxbio/remote_utils.py 86 86 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/sampleqc.py 221 221 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdata.py 768 251 67%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdb/__init__.py 285 213 25%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdb/base.py 16 7 56%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdb/event.py 37 14 62%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdb/exceptions.py 4 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdb/ref.py 25 6 76%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdb/serialization.py 132 105 20%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdb/storage.py 492 340 31%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdb/timestamps.py 15 9 40%
/home/runner/work/ctxbio/ctxbio/ctxbio/scdb/types.py 5 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/scoring.py 91 8 91%
/home/runner/work/ctxbio/ctxbio/ctxbio/sequence/__init__.py 2 2 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/sequence/bam_extract_bc_reads.py 30 30 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/sequence/bam_window_coverage.py 42 42 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/sequence/bams.py 42 42 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/sequence/exon_intron_ratio.py 93 93 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/sequence/fastq.py 19 19 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/sequence/reader.py 14 14 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/stats/__init__.py 0 0 100%
/home/runner/work/ctxbio/ctxbio/ctxbio/stats/autocorrelation.py 25 25 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/stats/deg.py 131 67 49%
/home/runner/work/ctxbio/ctxbio/ctxbio/stats/differential_abundance.py 178 178 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/stats/emd.py 106 106 0%
/home/runner/work/ctxbio/ctxbio/ctxbio/stats/gene_set_analysis.py 57 17 70%
/home/runner/work/ctxbio/ctxbio/ctxbio/stats/knnpurity.py 49 11 78%
/home/runner/work/ctxbio/ctxbio/ctxbio/stats/mixmodels.py 72 1 99%
/home/runner/work/ctxbio/ctxbio/ctxbio/utils.py 129 57 56%
---------------------------------------------------------------------------------------------
TOTAL 6334 3016 52%

=== 219 passed, 1 skipped, 15 deselected, 2441 warnings in 469.61s (0:07:49) ===
1 change: 0 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12770,7 +12770,6 @@ const isValidCoverageContent = (data) => {
'Stmts',
'Miss',
'Cover',
'Missing',
'TOTAL',
];

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pytest-coverage-comment",
"version": "1.1.2",
"version": "1.1.3",
"description": "Comments a pull request with the pytest code coverage badge, full report and tests summary",
"author": "Misha Kav",
"license": "MIT",
Expand Down
1 change: 0 additions & 1 deletion src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const isValidCoverageContent = (data) => {
'Stmts',
'Miss',
'Cover',
'Missing',
'TOTAL',
];

Expand Down

0 comments on commit 0fcf661

Please sign in to comment.