Skip to content

Commit

Permalink
Continuous integration workflow with GitHub's 'actions' (#51)
Browse files Browse the repository at this point in the history
* Continuous integration workflow with GitHub's 'actions'

* Download and cache OceansDB data

OceansDB is used for topography and climatology checks. These can be
relatively large files. Use a cache to run tests.

* Running pytest

* fix: _curvature_numpy() is now curvature()
  • Loading branch information
castelao committed Nov 10, 2020
1 parent c0a4d31 commit e6b98f1
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 1 deletion.
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CoTeDe

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.6, 3.7, 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 flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Cache ETOPO
id: cache-etopo
uses: actions/cache@v2
with:
path: |
~/.config/oceansdb/etopo5.nc
key: ${{ runner.os }}-ETOPO

- name: Download ETOPO database
if: steps.cache-etopo.outputs.cache-hit != 'true'
run: python -c "import oceansdb; oceansdb.ETOPO()['topography']"

- name: Cache WOA
id: cache-woa
uses: actions/cache@v2
with:
path: |
~/.config/oceansdb/woa18_decav_t13_5d.nc
~/.config/oceansdb/woa18_decav_t14_5d.nc
~/.config/oceansdb/woa18_decav_t15_5d.nc
~/.config/oceansdb/woa18_decav_t16_5d.nc
~/.config/oceansdb/woa18_decav_s13_5d.nc
~/.config/oceansdb/woa18_decav_s14_5d.nc
~/.config/oceansdb/woa18_decav_s15_5d.nc
~/.config/oceansdb/woa18_decav_s16_5d.nc
key: ${{ runner.os }}-WOA

- name: Download WOA database
if: steps.cache-woa.outputs.cache-hit != 'true'
run: |
python -c "import oceansdb; oceansdb.WOA()['sea_water_temperature']"
python -c "import oceansdb; oceansdb.WOA()['sea_water_salinity']"
- name: Cache CARS
id: cache-cars
uses: actions/cache@v2
with:
path: |
~/.config/oceansdb/temperature_cars2009a.nc
~/.config/oceansdb/salinity_cars2009a.nc
key: ${{ runner.os }}-CARS

- name: Download CARS database
if: steps.cache-cars.outputs.cache-hit != 'true'
run: |
python -c "import oceansdb; oceansdb.CARS()['sea_water_temperature']"
python -c "import oceansdb; oceansdb.CARS()['sea_water_salinity']"
- name: Test with pytest
run: |
pytest tests
2 changes: 1 addition & 1 deletion cotede/qctests/gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _curvature_pandas(x):
x = x.data

if not PANDAS_AVAILABLE:
return _curvature_numpy(x)
return curvature(x)

if hasattr(x, "to_series"):
x = x.to_series()
Expand Down

0 comments on commit e6b98f1

Please sign in to comment.