Skip to content

Commit

Permalink
Merge pull request #200 from EPFL-ENAC/fix-ci-coverage
Browse files Browse the repository at this point in the history
Fix CI coverage
  • Loading branch information
sphamba authored Nov 23, 2023
2 parents a3fe57e + d58287a commit c9ab15a
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 13 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ jobs:
experimental: false
coverage: true

- os: "windows-latest"
python-version: "3.11"
experimental: false

steps:
- uses: actions/checkout@v3

Expand All @@ -47,24 +43,28 @@ jobs:
- name: Test with pytest
run: |
coverage run -m pytest
pytest # See pyproject.toml for cov options
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
if: matrix.coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Generate coverage report in LCOV format
if: matrix.coverage
run: |
coverage lcov -o coverage/lcov.info
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml

- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
if: matrix.coverage
with:
parallel: true
files: lcov.info

- name: Upload coverage reports to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
if: matrix.coverage && github.ref == 'refs/heads/main'
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} # Not accessible from PR
coverage-reports: coverage.xml

end-coveralls:
needs: [tests]
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/tests_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests Windows
on: [push, pull_request, workflow_dispatch]

jobs:
tests:
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}${{ matrix.experimental && ' with latest dependencies' || '' }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}

strategy:
fail-fast: false
matrix:
os: ["windows-latest"]
python-version: ["3.9", "3.10", "3.11"]
experimental: [false]

steps:
- uses: actions/checkout@v3

- name: Set up micromamba and install package dependencies
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ${{ matrix.experimental && 'ci/environment_latest.yml' || 'ci/environment.yml' }}
create-args: >-
python=${{ matrix.python-version }}
init-shell: >-
bash
- name: Install the package
run: |
pip install -e .
- name: Test with pytest
run: |
coverage run -m pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
lcov.info
*.cover
*.py,cover
.hypothesis/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
| 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) |
| 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) |
| 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/) |
| 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) |
| 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) |
| Project Status | [![Project Status](https://www.repostatus.org/badges/latest/active.svg?style=flat)](https://www.repostatus.org/#active) |
| 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/) |
| 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) |
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ disdrodb_upload_station="disdrodb.data_transfer.scripts.disdrodb_upload_station:
# Metadata archive
disdrodb_check_metadata_archive="disdrodb.metadata.scripts.disdrodb_check_metadata_archive:disdrodb_check_metadata_archive"

[tool.pytest.ini_options]
addopts = "--cov --cov-report term-missing --cov-report xml --cov-report lcov:lcov.info"

[tool.ruff]
select = ["F",
"E",
Expand Down

0 comments on commit c9ab15a

Please sign in to comment.