Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tests to GitHub Actions #36

Merged
merged 7 commits into from
Mar 19, 2021
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow will cancel duplicate CI builds. For example, when rapidly pushing commits to a PR, if there are CI builds still running from an older commit they will be cancelled


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]
Comment on lines +11 to +12
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and added a Python 3.9 build as well as windows and macOS builds


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
16 changes: 16 additions & 0 deletions ci/environment-3.6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: xhistogram_test_env
dependencies:
- python=3.6
- 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From #34

- numpy=1.16
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of testing NumPy 1.16 and 1.17 on Python 3.6, the changes here test NumPy 1.16 on Python 3.6 and NumPy 1.17 on Python 3.7. My guess is this isn't a big deal, but let me know if we should changes what's here

- pytest
- pip
- pip:
- codecov
- pytest-cov
16 changes: 16 additions & 0 deletions ci/environment-3.7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: xhistogram_test_env
dependencies:
- python=3.7
- 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.17
- pytest
- pip
- pip:
- codecov
- pytest-cov
16 changes: 16 additions & 0 deletions ci/environment-3.8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: xhistogram_test_env
dependencies:
- python=3.8
- 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
- pytest
- pip
- pip:
- codecov
- pytest-cov
16 changes: 16 additions & 0 deletions ci/environment-3.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: xhistogram_test_env
dependencies:
- 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
- pytest
- pip
- pip:
- codecov
- pytest-cov
11 changes: 0 additions & 11 deletions ci/environment-py36-numpy1.16.yml

This file was deleted.

13 changes: 0 additions & 13 deletions ci/environment-py36-numpy1.17.yml

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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