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

add basic ci setup #20

Merged
merged 4 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
91 changes: 91 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI

on:
push:
branches: "*"
pull_request:
branches: main
schedule:
- cron: "0 0 * * *"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-python@v2.2.2
- uses: pre-commit/action@v2.0.3

test:
name: ${{ matrix.python-version }}-build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2.3.4
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
auto-activate-base: false
activate-environment: datatree
environment-file: ci/environment.yml
- name: Conda info
shell: bash -l {0}
run: conda info
- name: Conda list
shell: bash -l {0}
run: conda list
- name: Install datatree
shell: bash -l {0}
run: |
python -m pip install --no-deps -e .
python -m pip list
- name: Running Tests
shell: bash -l {0}
run: |
python -m pytest --cov=./ --cov-report=xml --verbose
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v2.0.2
# if: ${{ matrix.python-version }} == 3.8
# with:
# file: ./coverage.xml
# fail_ci_if_error: false

test-upstream:
name: ${{ matrix.python-version }}-dev-build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]
steps:
- uses: actions/checkout@v2.3.4
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
auto-activate-base: false
activate-environment: datatree
environment-file: ci/environment.yml
- name: Conda info
shell: bash -l {0}
run: conda info
- name: Conda list
shell: bash -l {0}
run: conda list
- name: Install dev reqs
shell: bash -l {0}
run: |
python -m pip install --no-deps --upgrade \
git+https://github.com/pydata/xarray \
git+https://github.com/Unidata/netcdf4-python \
git+https://github.com/c0fec0de/anytree
python -m pip install --no-deps -e .
python -m pip list
- name: Running Tests
shell: bash -l {0}
run: |
python -m pytest --verbose
26 changes: 26 additions & 0 deletions .github/workflows/pypipublish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Set up Python
uses: actions/setup-python@v2.2.1
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools-scm wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
56 changes: 56 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# https://pre-commit.com/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
# isort should run before black as black sometimes tweaks the isort output
- repo: https://github.com/PyCQA/isort
rev: 5.9.3
hooks:
- id: isort
# https://github.com/python/black#version-control-integration
- repo: https://github.com/psf/black
rev: 21.7b0
hooks:
- id: black
- repo: https://github.com/keewis/blackdoc
rev: v0.3.4
hooks:
- id: blackdoc
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
# - repo: https://github.com/Carreau/velin
# rev: 0.0.8
# hooks:
# - id: velin
# args: ["--write", "--compact"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
hooks:
- id: mypy
# Copied from setup.cfg
exclude: "properties|asv_bench"
additional_dependencies: [
# Type stubs
types-python-dateutil,
types-pkg_resources,
types-PyYAML,
types-pytz,
# Dependencies that are typed
numpy,
typing-extensions==3.10.0.0,
]
# run this occasionally, ref discussion https://github.com/pydata/xarray/pull/3194
# - repo: https://github.com/asottile/pyupgrade
# rev: v1.22.1
# hooks:
# - id: pyupgrade
# args:
# - "--py3-only"
# # remove on f-strings in Py3.7
# - "--keep-percent-format"
13 changes: 13 additions & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: datatree
channels:
- conda-forge
- nodefaults
dependencies:
- xarray >=0.19.0
- netcdf4
- anytree
- pytest
- flake8
- black
- codecov
- pytest-cov
2 changes: 1 addition & 1 deletion datatree/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.dev9+g805d97f.d20210817"
__version__ = "0.1.dev46+g415cbb7.d20210825"
6 changes: 6 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pytest
flake8
black
codecov
pytest-cov
-r requirements.txt
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
xarray>=0.19.0
netcdf4
anytree
future
29 changes: 14 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
from os.path import exists
from setuptools import find_packages, setup

install_requires = [
"xarray>=0.19.0",
"netcdf4"
"anytree",
"future",
]

extras_require = {'tests':
[
"pytest",
"flake8",
"black",
"codecov",
]
}
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')

if exists('README.rst'):
with open('README.rst') as f:
long_description = f.read()
else:
long_description = ''


setup(
name="datatree",
description="Hierarchical tree-like data structures for xarray",
long_description=long_description,
url="https://github.com/TomNicholas/datatree",
author="Thomas Nicholas",
author_email="thomas.nicholas@columbia.edu",
Expand All @@ -29,11 +26,13 @@
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: Apache License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
packages=find_packages(exclude=["docs", "tests", "tests.*", "docs.*"]),
install_requires=install_requires,
extras_require=extras_require,
python_requires=">=3.7",
setup_requires="setuptools_scm",
use_scm_version={
Expand Down