Skip to content
This repository was archived by the owner on Oct 24, 2024. It is now read-only.

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/[email protected]
- uses: actions/[email protected]
- uses: pre-commit/[email protected]

test:
name: ${{ matrix.python-version }}-build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/[email protected]
- 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/[email protected]
# 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/[email protected]
- 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/[email protected]
- name: Set up Python
uses: actions/[email protected]
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="[email protected]",
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