Skip to content

Commit

Permalink
tests with github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
martibosch committed May 28, 2021
1 parent b5b3964 commit 219b5dc
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 63 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:

build:

name: Python ${{ matrix.python-version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.6', '3.7', '3.8', '3.9']

defaults:
run:
shell: bash -l {0}

steps:

- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Cache conda
uses: actions/cache@v2
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment-dev.yml') }}

- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
use-only-tar-bz2: true # required for caching
show-channel-urls: true
channel-priority: strict
activate-environment: detectree-dev
environment-file: environment-dev.yml

- name: Install detectree
run: |
python setup.py install
conda list
conda info --all
- name: Lint code
run: |
isort detectree --check-only
black . --check --diff
flake8 .
pydocstyle detectree
- name: Test docs
run: make -C ./docs html

- name: Test code
run: |
coverage run --source ./detectree --module pytest --verbose
coverage xml -i
coverage report -m
- name: Upload coverage report
uses: codecov/codecov-action@v1
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.md.
3. The pull request should work for Python 3.6. Check https://travis-ci.org/martibosch/detectree/pull_requests and make sure that the tests pass for all supported Python versions.
3. The pull request should work for Python 3.6, 3.7, 3.8 and 3.9. Check https://travis-ci.org/martibosch/detectree/pull_requests and make sure that the tests pass for all supported Python versions.
4. Adhere to the following project standards:
* `black` code style with max line length of 79
* `isort` sorted imports
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![PyPI version fury.io](https://badge.fury.io/py/detectree.svg)](https://pypi.python.org/pypi/detectree/)
[![Documentation Status](https://readthedocs.org/projects/detectree/badge/?version=latest)](https://detectree.readthedocs.io/en/latest/?badge=latest)
[![Build Status](https://travis-ci.org/martibosch/detectree.svg?branch=master)](https://travis-ci.org/martibosch/detectree)
[![Coverage Status](https://coveralls.io/repos/github/martibosch/detectree/badge.svg?branch=master)](https://coveralls.io/github/martibosch/detectree?branch=master)
[![Build Status](https://github.com/martibosch/detectree/workflows/tests/badge.svg?branch=main)](https://github.com/martibosch/detectree/actions?query=workflow%3A%22tests%22)
[![codecov](https://codecov.io/gh/martibosch/detectree/branch/main/graph/badge.svg?token=ZTZK2LFR6T)](https://codecov.io/gh/martibosch/detectree)
[![GitHub license](https://img.shields.io/github/license/martibosch/detectree.svg)](https://github.com/martibosch/detectree/blob/master/LICENSE)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.02172/status.svg)](https://doi.org/10.21105/joss.02172)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3908338.svg)](https://doi.org/10.5281/zenodo.3908338)
Expand Down
37 changes: 37 additions & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: detectree-dev

channels:
- conda-forge

dependencies:
- dask
- distributed
- joblib
- laspy
- lastools
- laszip
- numpy>=1.15
- pandas>=0.23
- pip
- pip:
- pymaxflow>=1.0.0
- rasterio>=1.0.0
- scikit-image
- scikit-learn
- scipy>=1.0.0
- shapely
- tqdm

# linting/testing
- black
- bumpversion
- coverage
- coveralls
- isort
- flake8
- m2r
- pydocstyle
- pytest
- sphinx
- sphinx-click
- sphinxcontrib-bibtex
13 changes: 0 additions & 13 deletions requirements-dev.txt

This file was deleted.

3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ universal=1
description-file=README.md

[flake8]
exclude = ./build/*
ignore = E203,W503
per-file-ignores =
detectree/__init__.py:F401
tests/test_detectree.py:F401
tests/test_detectree.py:F401

[isort]
known_first_party = detectree
Expand Down

0 comments on commit 219b5dc

Please sign in to comment.