Skip to content

Commit

Permalink
Update CI to use GitHub Actions (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leah Wasser committed Dec 3, 2020
1 parent 2dc192e commit b78534d
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 152 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/lint-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow only runs linting and builds the documentation

name: Docs & Linting - Matrix OS / Python Version

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
setup-build:
name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
pip install black flake8
pip install -e .
- name: Build Docs
run: |
make docs -B
- name: Run Black
run: |
flake8 earthpy
- name: Run Flake8
run: |
flake8 earthpy
52 changes: 52 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow runs tests for earthpy
# Because we want a conda environment - and that builds slower,
# we divided up tests from linting and docs to make for simpler install envts

name: Run Tests - Matrix OS / Python Version

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
example-1:
name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Setup Conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
conda-channels: conda-forge
python-version: ${{ matrix.python-version }}

- name: Install Env
shell: bash
run: |
python --version
#conda env create -f ci/environment.yml
conda install -c conda-forge matplotlib \
pytest requests \
geopandas rasterio scikit-image
- name: Check Environment
shell: bash
run: |
conda list
python --version
- name: Run Tests
shell: bash
run: |
pytest -v --color=yes
python --version
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
repos:
- repo: https://github.com/psf/black
rev: stable
rev: 20.8b1
hooks:
- id: black
language_version: python3.7
language_version: python3
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7
hooks:
Expand Down
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .travis/install.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .travis/test.sh

This file was deleted.

37 changes: 0 additions & 37 deletions appveyor.yml

This file was deleted.

1 change: 0 additions & 1 deletion earthpy/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ def plot_bands(
... title=titles,
... figsize=(8, 3))
array([<AxesSubplot:title={'center':'Red'}>...
"""
show = False
try:
Expand Down
2 changes: 1 addition & 1 deletion earthpy/tests/test_plot_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_single_band_2dims(one_band_3dims):


def test_cbar_param(one_band_3dims):
"""Test that the colorbar param works for a single band arr."""
"""Test that the colorbar param works for a single band arr"""
one_band_2dims = one_band_3dims[0]
ax = ep.plot_bands(one_band_2dims, scale=True)
arr = ax.get_images()[0].get_array()
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
# Core scientific python
- numpy
- matplotlib
- python=3.6
# - python=3.6

# Geo stuff
- geopandas
Expand Down
5 changes: 4 additions & 1 deletion examples/plot_dem_hillshade.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@
hillshade = es.hillshade(elevation)

ep.plot_bands(
hillshade, cbar=False, title="Hillshade made from DTM", figsize=(10, 6),
hillshade,
cbar=False,
title="Hillshade made from DTM",
figsize=(10, 6),
)
plt.show()

Expand Down
4 changes: 2 additions & 2 deletions examples/plot_raster_stack_crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@
#############################################################################
# Crop Individual Bands
# ---------------------
# If you only need to crop one raster image, you can use EarthPy's
# If you only need to crop one raster image, you can use EarthPy's
# ``es.crop_image()`` function.
# This function takes a Rasterio object and crops it to the provided
# This function takes a Rasterio object and crops it to the provided
# spatial extent.

# Open Landsat image as a Rasterio object in order to crop it
Expand Down
4 changes: 2 additions & 2 deletions examples/plot_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
bound_utm13N = bound.to_crs(raster_profile["crs"])

################################################################################
# Create a Plot With the Boundary overlayed on the RGB Image
# Create a Plot With the Boundary overlayed on the RGB Image
# ----------------------------------------------------------
# You can plot a polygon boundary over an image by creating a raster extent
# for the plot using the ``plotting_extent`` function from ``rasterio.plot``.
Expand Down Expand Up @@ -205,7 +205,7 @@
###############################################################################
# Create Figure with Multiple Axes or Subplots
# --------------------------------------------
# ```plot_rgb()`` has an ``ax=`` parameter which supports subplots. You can
# ```plot_rgb()`` has an ``ax=`` parameter which supports subplots. You can
# create figures that contain multiple plots by creating multiple ax
# objects, one for each plot. You can also specify the number of rows and
# columns in which to display the plots. In the example below, the two plots
Expand Down
30 changes: 0 additions & 30 deletions tox.ini

This file was deleted.

0 comments on commit b78534d

Please sign in to comment.