Skip to content

Commit fb0610f

Browse files
jleratJulien Lerat
and
Julien Lerat
authored
test: publish code coverage results (#6)
* doc: removed bitbucket pipeline [ci-skip] * chore: moved pipeline and created reduced conda env spec * test: publish code coverage results * chore: fixed pipeline * chore: another attempt * chore: another pipeline try * fix: removed tqdm from script template to match with mini env * chore: added codecov upload * chore: added conda cache * chore: working on conda cache * chore: removed conda cache. can't figure it out * doc: added codecov badge to README.md --------- Co-authored-by: Julien Lerat <[email protected]>
1 parent f9fdad6 commit fb0610f

File tree

4 files changed

+32
-19
lines changed

4 files changed

+32
-19
lines changed

.github/workflows/python-package-conda.yml

+29-12
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,44 @@ jobs:
1919
uses: actions/setup-python@v3
2020
with:
2121
python-version: '3.10'
22-
22+
2323
- name: Add conda to system path
2424
run: |
2525
# $CONDA is an environment variable pointing to the root of the miniconda directory
2626
echo $CONDA/bin >> $GITHUB_PATH
27+
28+
- name: Create conda environment if needed
29+
run: |
30+
source $CONDA/etc/profile.d/conda.sh
31+
conda env create -f env_mini.yml
2732
28-
- name : Main pipeline
33+
- name : Install hydrodiy package in conda env
2934
run: |
30-
# Build conda
3135
source $CONDA/etc/profile.d/conda.sh
32-
conda env create -f env_mini.yml
33-
34-
# Activate conda
35-
conda activate env_mini || true
36-
37-
# Install hydrodiy
36+
conda activate env_mini
3837
pip install -e .
39-
40-
# Run test
38+
39+
- name: Run tests
40+
run: |
41+
source $CONDA/etc/profile.d/conda.sh
42+
conda activate env_mini
4143
pytest --cov=hydrodiy --cov-config=.coveragerc --junitxml=junit/test-results.xml --cov-report=xml --cov-report=html hydrodiy
44+
45+
- name: Upload pytest test results
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: pytest-results
49+
path: junit/test-results.xml
50+
51+
# Use always() to always run this step to publish test results when there are test failures
52+
if: ${{ always() }}
53+
54+
- name: Upload to codecov
55+
uses: codecov/codecov-action@v3
4256

43-
# Run examples
57+
- name: Run examples
58+
run: |
59+
source $CONDA/etc/profile.d/conda.sh
60+
conda activate env_mini
4461
python examples/run_all_examples.py
4562

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# hydrodiy
2-
[![CI](https://github.com/csiro-hydroinformatics/hydrodiy/actions/workflows/python-package-conda.yml/badge.svg)](https://github.com/csiro-hydroinformatics/hydrodiy/actions/workflows/python-package-conda.yml)
2+
[![CI](https://github.com/csiro-hydroinformatics/hydrodiy/actions/workflows/python-package-conda.yml/badge.svg)](https://github.com/csiro-hydroinformatics/hydrodiy/actions/workflows/python-package-conda.yml) [![codecov](https://codecov.io/gh/csiro-hydroinformatics/hydrodiy/graph/badge.svg?token=ARBFW69TI3)](https://codecov.io/gh/csiro-hydroinformatics/hydrodiy)
33

44
Python toolbox for hydrological data processing.
55

hydrodiy/io/script_template_plot.py

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
import pyproj
3636
from hydrodiy.gis.oz import ozlayer
3737

38-
import tqdm
39-
4038
# Code to facilitate import of a "utils" package
4139
#import utils
4240
#import importlib

hydrodiy/io/script_template_simple.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
from hydrodiy.io import csv, iutils
2020

21-
from tqdm import tqdm
22-
2321
#import importlib.util
2422
#spec = importlib.util.spec_from_file_location("foo", "/path/to/foo.py")
2523
#foo = importlib.util.module_from_spec(spec)
@@ -97,8 +95,8 @@
9795
# Process
9896
#----------------------------------------------------------------------
9997
nsites = len(sites)
100-
for isite, (siteid, sinfo) in tqdm(enumerate(sites.iterrows()), \
101-
total=nsites, disable=not progress):
98+
for isite, (siteid, sinfo) in enumerate(sites.iterrows()):
99+
102100
LOGGER.context = f"{siteid} ({isite+1}/{nsites})"
103101

104102
LOGGER.info("Processing")

0 commit comments

Comments
 (0)