Skip to content

Commit

Permalink
Add Github Actions system from climpred and xskillscore (#103)
Browse files Browse the repository at this point in the history
* Add Github Actions system for CI
* Removes Travis CI
* Switches to CodeCov for coverage testing
* Fixes bug with vectorize=True with new dask/xarray
  • Loading branch information
bradyrx authored Nov 13, 2020
1 parent e93391f commit 27e5817
Show file tree
Hide file tree
Showing 43 changed files with 792 additions and 603 deletions.
8 changes: 8 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
status:
project:
default:
# Require 50% coverage.
target: 50
patch: false
changes: false
4 changes: 0 additions & 4 deletions .coveragerc

This file was deleted.

1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/esmtools_installs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: esmtools installs

on: pull_request

jobs:
install-esmtools: # Installs esmtools on various OS.
name: Install esmtools, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
python -c "import esmtools"
44 changes: 44 additions & 0 deletions .github/workflows/esmtools_testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: esmtools testing

on: pull_request

jobs:
test: # Runs testing suite on various python versions.
name: Test esmtools, python ${{ matrix.python-version }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Set up conda
uses: conda-incubator/setup-miniconda@v1
with:
auto-update-conda: true
channels: conda-forge
mamba-version: '*'
activate-environment: esmtools-minimum-tests
python-version: ${{ matrix.python-version }}
- name: Set up conda environment
run: |
mamba env update -f ci/requirements/minimum-tests.yml
- name: Conda info
run: conda info
- name: Conda list
run: conda list
- name: Run tests
run: |
pytest --cov=esmtools --cov-report=xml --verbose
- name: Upload coverage to codecov
uses: codecov/codecov-action@v1.0.7
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

name: Lint

on: pull_request

jobs:
lint: # Runs linting package checks for code styling.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Lint via pre-commit checks
uses: pre-commit/action@v2.0.0
23 changes: 7 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v3.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-yaml
- id: double-quote-string-fixer
- id: no-commit-to-branch
- id: debug-statements
- id: check-merge-conflict
- id: check-added-large-files

- repo: https://github.com/ambv/black
rev: 19.10b0
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
args: ["--line-length", "88", "--skip-string-normalization"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
args: ["--max-line-length=88", "--exclude=__init__.py", "--ignore=W605,W503,F722,C901"]

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
rev: v5.6.4
hooks:
- id: isort
args: ["-w", "88"]

- repo: https://github.com/PyCQA/doc8
rev: 0.8.1rc2
hooks:
- id: doc8
args: ["--max-line-length", "100", "--ignore-path", "docs/source/setting-up-data.rst", "--allow-long-titles"]
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ Bug Fixes
---------
- :py:func:`~esmtools.temporal.to_annual` no longer returns ``0.0`` where the original
dataset had NaNs. (:issue:`75`) (:pr:`95`) `Riley X. Brady`_.
- :py:func:`~esmtools.stats.rm_poly` and :py:func:`~esmtools.stats.polyfit` now work
with newest ``dask`` and ``xarray`` versions. There was an issue with ``vectorize=True``
breaking ``xarray.apply_ufunc`` with a single time series. (:pr:`103`) `Riley X. Brady`_.

Internals
---------
- We now use Github Actions to do Continuous Integration instead of Travis, similar to
``climpred`` and ``xskillscore`` (:pr:`103`) `Riley X. Brady`_.

esmtools v1.1.3 (2020-07-17)
============================
Expand Down
57 changes: 45 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,60 @@

a toolbox for Earth System Model analysis

.. image:: https://travis-ci.org/bradyrx/esmtools.svg?branch=master
:target: https://travis-ci.org/bradyrx/esmtools
..
Table version of badges inspired by pySTEPS.
.. list-table::
:stub-columns: 1
:widths: 10 90

* - docs
- |docs|
* - tests
- |requires| |codecov|
* - package
- |conda| |pypi|
* - license
- |license|
* - community
- |contributors| |downloads|
* - tutorials
- |gallery|

.. |docs| image:: https://img.shields.io/readthedocs/esmtools/stable.svg?style=flat
:target: https://esmtools.readthedocs.io/en/stable/?badge=stable
:alt: Documentation Status

.. |requires| image:: https://requires.io/github/bradyrx/esmtools/requirements.svg?branch=master
:target: https://requires.io/github/bradyrx/esmtools/requirements/?branch=master
:alt: Requirements Status

.. image:: https://img.shields.io/pypi/v/esmtools.svg
:target: https://pypi.python.org/pypi/esmtools/
.. |codecov| image:: https://codecov.io/gh/bradyrx/esmtools/branch/master/graph/badge.svg
:target: https://codecov.io/gh/bradyrx/esmtools

.. image:: https://img.shields.io/conda/vn/conda-forge/esmtools.svg
.. |conda| image:: https://img.shields.io/conda/vn/conda-forge/esmtools.svg
:target: https://anaconda.org/conda-forge/esmtools
:alt: Conda Version

.. image:: https://coveralls.io/repos/github/bradyrx/esmtools/badge.svg?branch=master
:target: https://coveralls.io/github/bradyrx/esmtools?branch=master

.. image:: https://img.shields.io/readthedocs/esmtools/stable.svg?style=flat
:target: https://esmtools.readthedocs.io/en/stable/?badge=stable
:alt: Documentation Status
.. |pypi| image:: https://img.shields.io/pypi/v/esmtools.svg
:target: https://pypi.python.org/pypi/esmtools/

.. image:: https://img.shields.io/github/license/bradyrx/esmtools.svg
.. |license| image:: https://img.shields.io/github/license/bradyrx/esmtools.svg
:alt: license
:target: LICENSE.txt

.. |contributors| image:: https://img.shields.io/github/contributors/bradyrx/esmtools
:alt: GitHub contributors
:target: https://github.com/bradyrx/esmtools/graphs/contributors

.. |downloads| image:: https://img.shields.io/conda/dn/conda-forge/esmtools
:alt: Conda downloads
:target: https://anaconda.org/conda-forge/esmtools

.. |gallery| image:: https://img.shields.io/badge/esmtools-example_gallery-ed7b0e.svg
:alt: climpred gallery
:target: https://esmtools.readthedocs.io/en/stable/examples.html

Installation
============

Expand Down
26 changes: 26 additions & 0 deletions ci/requirements/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: esmtools-docs
channels:
- conda-forge
dependencies:
- python=3.6
- bottleneck
- cartopy>=0.18.0
- importlib_metadata
- jupyterlab
- matplotlib
- nbsphinx
- nc-time-axis
- netcdf4
- numpy
- pandas
- pygments==2.6.1
- sphinx
- sphinxcontrib-napoleon
- sphinx_rtd_theme
- toolz
- tqdm
- xarray>=0.16.1
- pip
- pip:
# Install latest version of climpred.
- -e ../..
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: esmtools-dev
channels:
- conda-forge
dependencies:
- python=3.6
# Documentation
- nbsphinx
- nbstripout
Expand Down
19 changes: 19 additions & 0 deletions ci/requirements/minimum-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: esmtools-minimum-tests
channels:
- conda-forge
dependencies:
- cftime
- coveralls
- dask
- ipython
- nc-time-axis
- netcdf4
- pip
- pytest
- pytest-cov
- scipy
- xarray
- xskillscore
- pip:
- pytest-lazy-fixture
- -e ../..
13 changes: 0 additions & 13 deletions ci/run-linter.sh

This file was deleted.

Loading

0 comments on commit 27e5817

Please sign in to comment.