Skip to content

Commit 80c17f0

Browse files
authoredOct 2, 2020
Update CI to Github Actions (#471)
* Change from Travis CI to Github Actions * require 90% coverage
1 parent 6625e0a commit 80c17f0

20 files changed

+182
-102
lines changed
 

‎.codecov.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
# Require 90% coverage.
6+
target: 90
7+
patch: false
8+
changes: false

‎.coveragerc

-8
This file was deleted.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: climpred installs
2+
3+
on: [push]
4+
5+
jobs:
6+
install-climpred: # Installs climpred on various OS.
7+
name: Install climpred, ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Setup python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.6
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install -e .
22+
python -c "import climpred"
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: climpred testing
2+
3+
on: [push]
4+
5+
jobs:
6+
test: # Runs testing suite on various python versions.
7+
name: Test climpred, python ${{ matrix.python-version }}
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.6, 3.7, 3.8]
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Install Conda environment
15+
uses: conda-incubator/setup-miniconda@v1
16+
with:
17+
auto-update-conda: true
18+
activate-environment: climpred-minimum-tests
19+
environment-file: ci/requirements/minimum-tests.yml
20+
python-version: ${{ matrix.python-version }}
21+
- name: Conda info
22+
shell: bash -l {0}
23+
run: conda info
24+
- name: Conda list
25+
shell: bash -l {0}
26+
run: conda list
27+
- name: Run tests
28+
shell: bash -l {0}
29+
run: |
30+
conda activate climpred-minimum-tests
31+
pytest --cov=climpred --cov-report=xml
32+
- name: Upload coverage to codecov
33+
uses: codecov/codecov-action@v1
34+
with:
35+
file: ./coverage.xml
36+
fail_ci_if_error: true
37+
38+
docs_notebooks: # Checks that pre-compiled notebooks in docs still work.
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: Install Conda environment
43+
uses: conda-incubator/setup-miniconda@v1
44+
with:
45+
auto-update-conda: true
46+
activate-environment: climpred-docs-notebooks
47+
environment-file: ci/requirements/docs_notebooks.yml
48+
python-version: 3.6
49+
- name: Conda info
50+
shell: bash -l {0}
51+
run: conda info
52+
- name: Conda list
53+
shell: bash -l {0}
54+
run: conda list
55+
- name: Test notebooks in docs
56+
shell: bash -l {0}
57+
run: |
58+
pushd docs
59+
nbstripout source/*.ipynb source/examples/decadal/*.ipynb source/examples/subseasonal/*.ipynb
60+
make html
61+
popd

‎.github/workflows/lint.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint
2+
3+
on: [push]
4+
5+
jobs:
6+
lint: # Runs linting package checks for code styling.
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up Python
11+
uses: actions/setup-python@v2
12+
with:
13+
python-version: 3.6
14+
- name: Install linting dependencies
15+
run: |
16+
python -m pip install --upgrade pip
17+
pip install flake8 black==19.10b0 isort
18+
- name: Lint with flake8
19+
shell: bash -l {0}
20+
run: |
21+
flake8 climpred
22+
- name: Lint with black
23+
shell: bash -l {0}
24+
run: |
25+
black --check climpred
26+
- name: Lint with isort
27+
shell: bash -l {0}
28+
run: |
29+
isort --check-only climpred

‎.github/workflows/python-package.yml

-33
This file was deleted.

‎.travis.yml

-39
This file was deleted.

‎CHANGELOG.rst

+2
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ Internals/Minor Fixes
138138
``matplotlib`` version. Update ``xskillscore`` requirement to 0.0.18 to
139139
cooperate with new ``xarray`` version. (:pr:`451`, :pr:`449`)
140140
`Riley X. Brady`_
141+
- Switch from Travis CI and Coveralls to Github Actions and CodeCov.
142+
(:pr:`471`) `Riley X. Brady`_
141143

142144

143145

‎README.rst

+2-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Verification of weather and climate forecasts.
3333
:target: https://requires.io/github/pangeo-data/climpred/requirements/?branch=master
3434
:alt: Requirements Status
3535

36-
.. |codecov| image:: https://coveralls.io/repos/github/pangeo-data/climpred/badge.svg?branch=master
37-
:target: https://coveralls.io/github/pangeo-data/climpred?branch=master
36+
.. |codecov| image:: https://codecov.io/gh/pangeo-data/climpred/branch/master/graph/badge.svg?token=e53kXaaOqS
37+
:target: https://codecov.io/gh/pangeo-data/climpred
3838

3939
.. |conda| image:: https://img.shields.io/conda/vn/conda-forge/climpred.svg
4040
:target: https://anaconda.org/conda-forge/climpred
@@ -88,5 +88,3 @@ Documentation
8888
Documentation is in development and can be found on readthedocs_.
8989

9090
.. _readthedocs: https://climpred.readthedocs.io/en/latest/
91-
92-
DELETE THIS

‎ci/requirements/environment-dev-3.6.yml ‎ci/requirements/climpred-dev.yml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: climpred-dev
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.6
65
# Documentation
76
- nbsphinx
87
- nbstripout

‎ci/requirements/docs_notebooks.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: climpred-docs-notebooks
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- xesmf
6+
- esmpy
7+
- bottleneck
8+
- cartopy>=0.18.0
9+
- esmtools>=1.1.3
10+
- importlib_metadata
11+
- jupyterlab
12+
- matplotlib
13+
- nbsphinx
14+
- nbstripout
15+
- nc-time-axis
16+
- netcdf4
17+
- numpy
18+
- pandas
19+
- pygments==2.6.1
20+
- sphinx
21+
- sphinxcontrib-napoleon
22+
- sphinx_rtd_theme
23+
- toolz
24+
- tqdm
25+
- xarray>=0.16.1
26+
- pip
27+
- pip:
28+
# Install latest version of climpred.
29+
- -e ../..

‎ci/requirements/minimum-tests.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: climpred-minimum-tests
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- xesmf
7+
- esmpy
8+
- dask
9+
- netcdf4
10+
- ipython
11+
- nc-time-axis
12+
- coveralls
13+
- pytest
14+
- pytest-cov
15+
- pip
16+
- pip:
17+
- pytest-lazy-fixture
18+
- -e ../..

‎ci/run-linter.sh

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ set -eo pipefail
44

55
echo "Code Styling with (black, flake8, isort)"
66

7-
source activate climpred-dev
8-
97
echo "[flake8]"
108
flake8 climpred --exclude=__init__.py
119

‎climpred/comparisons.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def _e2c(ds, metric=None):
198198
"""
199199
Compare ensemble mean forecast to single member verification.
200200
If the initialized dataset is concatinated in a way that the first member
201-
is taken from the control simulation, this compares the member mean of all
201+
is taken from the control simulation, this compares the member mean of all
202202
other member forecasts to the control simulation.
203203
204204
Args:

‎climpred/tests/test_perfectModelEnsemble_class.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def test_calendar_matching_control(PM_da_initialized_1d, PM_ds_control_1d):
179179
pm = pm.add_control(PM_ds_control_1d)
180180
assert "does not match" in str(excinfo.value)
181181

182-
182+
183183
def test_HindcastEnsemble_as_PerfectModelEnsemble(hindcast_recon_1d_mm):
184184
"""Test that initialized dataset for HindcastEnsemble can also be used for
185185
PerfectModelEnsemble."""
@@ -193,7 +193,7 @@ def test_HindcastEnsemble_as_PerfectModelEnsemble(hindcast_recon_1d_mm):
193193
.isnull()
194194
.any()
195195
)
196-
196+
197197
# try PerfectModelEnsemble predictability
198198
init = hindcast.get_initialized()
199199
print(init.lead)
@@ -210,7 +210,7 @@ def test_HindcastEnsemble_as_PerfectModelEnsemble(hindcast_recon_1d_mm):
210210
.isnull()
211211
.any()
212212
)
213-
213+
214214
# generate_uninitialized
215215
pm = pm.generate_uninitialized()
216216
assert (
@@ -227,7 +227,6 @@ def test_HindcastEnsemble_as_PerfectModelEnsemble(hindcast_recon_1d_mm):
227227
pm.bootstrap(iterations=2, metric="acc", comparison="m2e", dim=["member", "init"])
228228

229229

230-
231230
def test_verify_no_need_for_control(PM_da_initialized_1d, PM_da_control_1d):
232231
"""Tests that no error is thrown when no control present
233232
when calling verify(reference=['uninitialized'])."""

‎climpred/tests/test_versioning.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import pytest
22

3-
from climpred.versioning.print_versions import main, show_versions
3+
from climpred.versioning.print_versions import show_versions
44

55

66
@pytest.mark.parametrize("as_json", [True, False])
77
def test_show_versions(as_json):
88
show_versions(as_json=as_json)
9-
10-
11-
def test_main():
12-
main()

‎climpred/versioning/print_versions.py

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def show_versions(as_json=False):
7979
("setuptools", lambda mod: mod.__version__),
8080
("pip", lambda mod: mod.__version__),
8181
("conda", lambda mod: mod.__version__),
82-
("pytest", lambda mod: mod.__version__),
8382
# Misc.
8483
("IPython", lambda mod: mod.__version__),
8584
("sphinx", lambda mod: mod.__version__),

‎docs/source/contributing.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ documents. Some helpful guides are located
8787

8888
.. code:: bash
8989
90-
$ conda env update -f ci/requirements/environment-dev-3.6.yml
90+
$ conda env update -f ci/requirements/climpred-dev.yml
9191
$ cd docs
9292
$ make html
9393
@@ -124,7 +124,7 @@ Preparing Pull Requests
124124

125125
#. Install dependencies into a new conda environment::
126126

127-
$ conda env update -f ci/requirements/environment-dev-3.6.yml
127+
$ conda env update -f ci/requirements/climpred-dev.yml
128128
$ conda activate climpred-dev
129129

130130
#. Make an editable install of climpred by running::

‎docs/source/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ climpred: verification of weather and climate forecasts
3232
:target: https://requires.io/github/pangeo-data/climpred/requirements/?branch=master
3333
:alt: Requirements Status
3434

35-
.. |codecov| image:: https://coveralls.io/repos/github/pangeo-data/climpred/badge.svg?branch=master
36-
:target: https://coveralls.io/github/pangeo-data/climpred?branch=master
35+
.. |codecov| image:: https://codecov.io/gh/pangeo-data/climpred/branch/master/graph/badge.svg?token=e53kXaaOqS
36+
:target: https://codecov.io/gh/pangeo-data/climpred
3737

3838
.. |conda| image:: https://img.shields.io/conda/vn/conda-forge/climpred.svg
3939
:target: https://anaconda.org/conda-forge/climpred

‎requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
cftime>=1.1.2
22
eofs
33
esmtools>=1.1.3
4+
ipython
45
matplotlib
56
numpy
67
pandas
78
scipy
9+
toolz
810
tqdm
911
xarray>=0.16.1
1012
xrft==0.2.0

0 commit comments

Comments
 (0)
Please sign in to comment.