Skip to content

Commit

Permalink
Switch CI to github actions (#80)
Browse files Browse the repository at this point in the history
* Create ci.yaml

* Create linting.yaml

* Update .pre-commit-config.yaml

* Delete .stickler.yml

* Delete .travis.yml

* Update README.md

* Create codecov.yml

* Delete .coveragerc

* Update setup.cfg

* Update setup.py

* Update and rename environment-py37-upstream_master.yml to environment-upstream-dev

* Rename environment-py37.yml to environment-py3.7.yml

* Rename environment-py38.yml to environment-py3.8.yml

* Update ci.yaml

* Update ci.yaml

* Rename environment-upstream-dev to environment-upstream-dev.yml

* Update setup.py

* Update environment-py3.7.yml

* Update environment-py3.8.yml

* Update environment-upstream-dev.yml

* Update environment-upstream-dev.yml

* Update environment-upstream-dev.yml

* Update ci.yaml
  • Loading branch information
jbusecke committed Dec 1, 2020
1 parent a087f05 commit f7aebd1
Show file tree
Hide file tree
Showing 13 changed files with 185 additions and 102 deletions.
13 changes: 0 additions & 13 deletions .coveragerc

This file was deleted.

83 changes: 83 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI
on:
push:
branches:
- "master"
pull_request:
branches:
- "*"
schedule:
- cron: "0 13 * * 1"

jobs:
build:
name: Build (${{ matrix.python-version }} | ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7", "3.8"]
steps:
- uses: actions/checkout@v2
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env_xarrayutils # Defined in ci/environment*.yml
auto-update-conda: false
python-version: ${{ matrix.python-version }}
environment-file: ci/environment-py${{ matrix.python-version }}.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Set up conda environment
shell: bash -l {0}
run: |
python -m pip install -e .
conda list
- name: Run Tests
shell: bash -l {0}
run: |
pytest -n auto --cov=./ --cov-report=xml
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
upstream-dev:
name: Build (upstream-dev)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if ci/environment-upstream-dev.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-upstream-dev.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env_xarrayutils # Defined in ci/environment-upstream-dev.yml
auto-update-conda: false
python-version: 3.8
environment-file: ci/environment-upstream-dev.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Set up conda environment
shell: bash -l {0}
run: |
python -m pip install -e .
conda list
- name: Run Tests
shell: bash -l {0}
run: |
pytest -n auto
19 changes: 19 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: code-style
on:
push:
branches: "*"
pull_request:
branches: master
jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: set up python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Run pre-commit
uses: pre-commit/[email protected]
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
repos:
- repo: local
- repo: https://github.com/python/black
rev: stable
hooks:
- id: black
name: black
language: system
entry: black
types: ["python"]
5 changes: 0 additions & 5 deletions .stickler.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/jbusecke/xarrayutils.svg?branch=master)](https://travis-ci.com/jbusecke/xarrayutils)
[![Build Status](https://img.shields.io/github/workflow/status/xgcm/xgcm/CI?logo=github)](https://github.com/xgcm/xgcm/actions)
[![codecov](https://codecov.io/gh/jbusecke/xarrayutils/branch/master/graph/badge.svg)](https://codecov.io/gh/jbusecke/xarrayutils)
[![License:MIT](https://img.shields.io/badge/License-MIT-lightgray.svg?style=flt-square)](https://opensource.org/licenses/MIT)
[![pypi](https://img.shields.io/pypi/v/xarrayutils.svg)](https://pypi.org/project/xarrayutils)
Expand Down
1 change: 1 addition & 0 deletions ci/environment-py37.yml → ci/environment-py3.7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dependencies:
- pip:
- codecov
- pytest-cov
- pytest-xdist
1 change: 1 addition & 0 deletions ci/environment-py38.yml → ci/environment-py3.8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dependencies:
- pip:
- codecov
- pytest-cov
- pytest-xdist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test_env_xarrayutils
channels:
- conda-forge
dependencies:
- python=3.7
- python=3.8
- dask
- numpy
- pytest
Expand All @@ -14,9 +14,11 @@ dependencies:
- gsw
- cartopy
- pip
- cf_xarray
- cf_xarray
- pip:
- git+https://github.com/pydata/xarray.git
- git+https://github.com/xgcm/xgcm.git
- pytest
- codecov
- pytest-cov
- pytest-xdist
16 changes: 16 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
codecov:
require_ci_to_pass: no
max_report_age: off

comment: false

coverage:
precision: 2
round: down
status:
project:
default:
target: 95
informational: true
patch: off
changes: off
13 changes: 13 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@ versionfile_source = xarrayutils/_version.py
versionfile_build = xarrayutils/_version.py
tag_prefix =
parentdir_prefix = xarrayutils-

[flake8]
exclude = __init__.py,versioneer.py,.eggs,doc
ignore =
# whitespace before ':' - doesn't work well with black
E203
E402
# line too long - let black worry about that
E501
# do not assign a lambda expression, use a def
E731
# line break before binary operator
W503
86 changes: 45 additions & 41 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,55 @@
import sys
import os
import versioneer
from setuptools import setup, find_packages

DISTNAME = "xarrayutils"
LICENSE = "MIT"
AUTHOR = "Julius Busecke"
AUTHOR_EMAIL = "[email protected]"
URL = "https://github.com/jbusecke/xarrayutils"
CLASSIFIERS = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering",
]

INSTALL_REQUIRES = ["xarray >= 0.15.0"]
SETUP_REQUIRES = ["pytest-runner"]
TESTS_REQUIRE = ["pytest >= 2.8", "coverage"]
here = os.path.dirname(__file__)
with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()

if sys.version_info[:2] < (2, 7):
TESTS_REQUIRE += ["unittest2 == 0.5.1"]
install_requires = ["xarray>=0.14.1", "dask", "numpy"]
doc_requires = [
"sphinx",
"sphinxcontrib-srclinks",
"sphinx-pangeo-theme",
"numpydoc",
"IPython",
"nbsphinx",
]

DESCRIPTION = "Utilities for xarray dataarrays/datasets"
LONG_DESCRIPTION = """To be written.
"""
extras_require = {
"complete": install_requires,
"docs": doc_requires,
}
extras_require["dev"] = extras_require["complete"] + [
"pytest",
"pytest-cov",
"flake8",
"black",
"codecov",
]

setup(
name=DISTNAME,
name="xarrayutils",
description="A collection of various tools for data analysis built on top of xarray and xgcm",
url="https://github.com/jbusecke/xarrayutils",
author="xarrayutils Developers",
author_email="[email protected]",
license="MIT",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
packages=find_packages(exclude=["docs", "tests", "tests.*", "docs.*"]),
install_requires=install_requires,
extras_require=extras_require,
python_requires=">=3.7",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
license=LICENSE,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
classifiers=CLASSIFIERS,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
install_requires=INSTALL_REQUIRES,
setup_requires=SETUP_REQUIRES,
tests_require=TESTS_REQUIRE,
url=URL,
packages=find_packages(),
long_description=long_description,
long_description_content_type="text/markdown",
)

0 comments on commit f7aebd1

Please sign in to comment.