Skip to content

Commit c9ab15a

Browse files
authored
Merge pull request #200 from EPFL-ENAC/fix-ci-coverage
Fix CI coverage
2 parents a3fe57e + d58287a commit c9ab15a

File tree

5 files changed

+54
-13
lines changed

5 files changed

+54
-13
lines changed

.github/workflows/tests.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ jobs:
2525
experimental: false
2626
coverage: true
2727

28-
- os: "windows-latest"
29-
python-version: "3.11"
30-
experimental: false
31-
3228
steps:
3329
- uses: actions/checkout@v3
3430

@@ -47,24 +43,28 @@ jobs:
4743
4844
- name: Test with pytest
4945
run: |
50-
coverage run -m pytest
46+
pytest # See pyproject.toml for cov options
5147
5248
- name: Upload coverage reports to Codecov
5349
uses: codecov/codecov-action@v3
5450
if: matrix.coverage
55-
env:
56-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
57-
58-
- name: Generate coverage report in LCOV format
59-
if: matrix.coverage
60-
run: |
61-
coverage lcov -o coverage/lcov.info
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
files: coverage.xml
6254

6355
- name: Coveralls Parallel
6456
uses: coverallsapp/github-action@v2
6557
if: matrix.coverage
6658
with:
6759
parallel: true
60+
files: lcov.info
61+
62+
- name: Upload coverage reports to Codacy
63+
uses: codacy/codacy-coverage-reporter-action@v1
64+
if: matrix.coverage && github.ref == 'refs/heads/main'
65+
with:
66+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} # Not accessible from PR
67+
coverage-reports: coverage.xml
6868

6969
end-coveralls:
7070
needs: [tests]

.github/workflows/tests_windows.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Tests Windows
2+
on: [push, pull_request, workflow_dispatch]
3+
4+
jobs:
5+
tests:
6+
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}${{ matrix.experimental && ' with latest dependencies' || '' }}
7+
runs-on: ${{ matrix.os }}
8+
defaults:
9+
run:
10+
shell: bash -el {0}
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: ["windows-latest"]
16+
python-version: ["3.9", "3.10", "3.11"]
17+
experimental: [false]
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Set up micromamba and install package dependencies
23+
uses: mamba-org/setup-micromamba@v1
24+
with:
25+
environment-file: ${{ matrix.experimental && 'ci/environment_latest.yml' || 'ci/environment.yml' }}
26+
create-args: >-
27+
python=${{ matrix.python-version }}
28+
init-shell: >-
29+
bash
30+
31+
- name: Install the package
32+
run: |
33+
pip install -e .
34+
35+
- name: Test with pytest
36+
run: |
37+
coverage run -m pytest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ htmlcov/
5757
.cache
5858
nosetests.xml
5959
coverage.xml
60+
lcov.info
6061
*.cover
6162
*.py,cover
6263
.hypothesis/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
| Deployment | [![PyPI](https://badge.fury.io/py/disdrodb.svg?style=flat)](https://pypi.org/project/disdrodb/) [![Conda](https://img.shields.io/conda/vn/conda-forge/disdrodb.svg?logo=conda-forge&logoColor=white&style=flat)](https://anaconda.org/conda-forge/disdrodb) |
66
| Activity | [![PyPI Downloads](https://img.shields.io/pypi/dm/disdrodb.svg?label=PyPI%20downloads&style=flat)](https://pypi.org/project/disdrodb/) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/disdrodb.svg?label=Conda%20downloads&style=flat)](https://anaconda.org/conda-forge/disdrodb) |
77
| Python Versions | [![Python Versions](https://img.shields.io/badge/Python-3.8%20%203.9%20%203.10%20%203.11%20%203.12-blue?style=flat)](https://www.python.org/downloads/) |
8-
| Supported Systems | [![Linux](https://img.shields.io/github/actions/workflow/status/ltelab/disdrodb/.github/workflows/tests.yml?label=Linux&style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [![macOS](https://img.shields.io/github/actions/workflow/status/ltelab/disdrodb/.github/workflows/tests.yml?label=macOS&style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [![Windows](https://img.shields.io/github/actions/workflow/status/ltelab/disdrodb/.github/workflows/tests.yml?label=Windows&style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) |
8+
| Supported Systems | [![Linux](https://img.shields.io/github/actions/workflow/status/ltelab/disdrodb/.github/workflows/tests.yml?label=Linux&style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [![macOS](https://img.shields.io/github/actions/workflow/status/ltelab/disdrodb/.github/workflows/tests.yml?label=macOS&style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [![Windows](https://img.shields.io/github/actions/workflow/status/ltelab/disdrodb/.github/workflows/tests_windows.yml?label=Windows&style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests_windows.yml) |
99
| Project Status | [![Project Status](https://www.repostatus.org/badges/latest/active.svg?style=flat)](https://www.repostatus.org/#active) |
1010
| Build Status | [![Tests](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml/badge.svg?style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [![Lint](https://github.com/ltelab/disdrodb/actions/workflows/lint.yml/badge.svg?style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/lint.yml) [![Docs](https://readthedocs.org/projects/disdrodb/badge/?version=latest&style=flat)](https://disdrodb.readthedocs.io/en/latest/) |
1111
| Linting | [![Black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat)](https://github.com/psf/black) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat)](https://github.com/astral-sh/ruff) [![Codespell](https://img.shields.io/badge/Codespell-enabled-brightgreen?style=flat)](https://github.com/codespell-project/codespell) |

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ disdrodb_upload_station="disdrodb.data_transfer.scripts.disdrodb_upload_station:
7777
# Metadata archive
7878
disdrodb_check_metadata_archive="disdrodb.metadata.scripts.disdrodb_check_metadata_archive:disdrodb_check_metadata_archive"
7979

80+
[tool.pytest.ini_options]
81+
addopts = "--cov --cov-report term-missing --cov-report xml --cov-report lcov:lcov.info"
82+
8083
[tool.ruff]
8184
select = ["F",
8285
"E",

0 commit comments

Comments
 (0)