Skip to content

Commit

Permalink
Move tests to GitHub Actions (#36)
Browse files Browse the repository at this point in the history
* Initial GHA infrastucture

* Apply dask version constraint in CI

* Add cancel workflow

* Add coverage back in

* Remove .travis.yml

* Update README badge
  • Loading branch information
jrbourbeau committed Mar 19, 2021
1 parent 2c221ed commit bb1fa23
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 87 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/cancel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Cancel

on:
workflow_run:
workflows: ["Tests", "Upstream", "Linting"]
types:
- requested

jobs:
cancel:
runs-on: ubuntu-latest
steps:
- uses: styfle/cancel-workflow-action@0.8.0
with:
workflow_id: ${{ github.event.workflow.id }}
36 changes: 36 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tests

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
environment-file: ci/environment-${{ matrix.python-version }}.yml
activate-environment: xhistogram_test_env
auto-activate-base: false

- name: Install
shell: bash -l {0}
run: python -m pip install -e .

- name: Run tests
shell: bash -l {0}
run: python -m pytest --cov=xhistogram --cov-report=xml xhistogram

- name: Coverage
uses: codecov/codecov-action@v1
40 changes: 40 additions & 0 deletions .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Upstream

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]

steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
environment-file: ci/environment-${{ matrix.python-version }}.yml
activate-environment: xhistogram_test_env
auto-activate-base: false

- name: Install upstream packages
shell: bash -l {0}
run: |
python -m pip install git+https://github.com/dask/dask.git
python -m pip install git+https://github.com/pydata/xarray.git
- name: Install
shell: bash -l {0}
run: python -m pip install -e .

- name: Run tests
shell: bash -l {0}
run: python -m pytest --cov=xhistogram --cov-report=xml xhistogram

- name: Coverage
uses: codecov/codecov-action@v1
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
xhistogram: Fast, flexible, label-aware histograms for numpy and xarray
=======================================================================

|pypi| |conda forge| |Build Status| |codecov| |docs| |linting| |license|
|pypi| |conda forge| |tests| |linting| |codecov| |docs| |license|

For more information, including installation instructions, read the full
`xhistogram documentation`_.
Expand All @@ -16,8 +16,8 @@ For more information, including installation instructions, read the full
:target: https://anaconda.org/conda-forge/xhistogram
.. |DOI| image:: https://zenodo.org/badge/41581350.svg
:target: https://zenodo.org/badge/latestdoi/41581350
.. |Build Status| image:: https://travis-ci.org/xgcm/xhistogram.svg?branch=master
:target: https://travis-ci.org/xgcm/xhistogram
.. |tests| image:: https://github.com/xgcm/xhistogram/actions/workflows/tests.yml/badge.svg
:target: https://github.com/xgcm/xhistogram/actions/workflows/tests.yml
:alt: travis-ci build status
.. |codecov| image:: https://codecov.io/github/xgcm/xhistogram/coverage.svg?branch=master
:target: https://codecov.io/github/xgcm/xhistogram?branch=master
Expand Down
2 changes: 1 addition & 1 deletion ci/environment-py36.yml → ci/environment-3.6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
# see https://github.com/dask/dask/pull/7391
# and https://github.com/xgcm/xhistogram/issues/27
- dask!=2021.3.0
- numpy
- numpy=1.16
- pytest
- pip
- pip:
Expand Down
2 changes: 1 addition & 1 deletion ci/environment-py37.yml → ci/environment-3.7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
# see https://github.com/dask/dask/pull/7391
# and https://github.com/xgcm/xhistogram/issues/27
- dask!=2021.3.0
- numpy
- numpy=1.17
- pytest
- pip
- pip:
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ci/environment-py36-numpy1.16.yml → ci/environment-3.9.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: xhistogram_test_env
dependencies:
- python=3.6
- python=3.9
- xarray
# Dask 2021.3.0 introduced a regression which broke xhistogram.
# This regression should be fixed in the next Dask release and we
# should remove the dask version pinning below.
# see https://github.com/dask/dask/pull/7391
# and https://github.com/xgcm/xhistogram/issues/27
- dask!=2021.3.0
- numpy==1.16
- numpy
- pytest
- pip
- pip:
Expand Down
18 changes: 0 additions & 18 deletions ci/environment-py36-numpy1.17.yml

This file was deleted.

11 changes: 0 additions & 11 deletions ci/environment-py38-upstream.yml

This file was deleted.

5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ parentdir_prefix = xhistogram-

[flake8]
exclude = __init__.py,versioneer.py,_version.py
max-line-length = 120
max-line-length = 120

[tool:pytest]
addopts = -v --durations=10

0 comments on commit bb1fa23

Please sign in to comment.