Skip to content

Commit

Permalink
Modernize CI workflow (#97)
Browse files Browse the repository at this point in the history
* Modernize CI worflow

* Delete environment-py3.7.yml

* Rename environment-py3.8.yml to environment.yml

* Update ci.yaml

* Update environment.yml

* Update environment-upstream-dev.yml

* Update environment.yml

* Update environment-upstream-dev.yml

* drop support for 3.7

* Update ci.yaml

* Update environment-upstream-dev.yml

* Update environment.yml

* Update ci.yaml
  • Loading branch information
jbusecke committed Jun 22, 2021
1 parent 7b70f15 commit af4ba48
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 45 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ on:
- "*"
schedule:
- cron: "0 13 * * 1"
workflow_dispatch:

jobs:
build:
name: Build (${{ matrix.python-version }} | ${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7", "3.8"]
python-version: ["3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- name: Cache conda
Expand All @@ -27,23 +31,21 @@ jobs:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}.yml') }}
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
channels: conda-forge, defaults
activate-environment: test_env_xarrayutils # Defined in ci/environment*.yml
auto-update-conda: false
python-version: ${{ matrix.python-version }}
environment-file: ci/environment-py${{ matrix.python-version }}.yml
environment-file: ci/environment.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Set up conda environment
shell: bash -l {0}
run: |
python -m pip install -e .
conda list
- name: Run Tests
shell: bash -l {0}
run: |
pytest -n auto --cov=./ --cov-report=xml
- name: Upload code coverage to Codecov
Expand All @@ -57,6 +59,9 @@ jobs:
upstream-dev:
name: Build (upstream-dev)
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Cache conda
Expand All @@ -71,15 +76,12 @@ jobs:
with:
activate-environment: test_env_xarrayutils # Defined in ci/environment-upstream-dev.yml
auto-update-conda: false
python-version: 3.8
environment-file: ci/environment-upstream-dev.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Set up conda environment
shell: bash -l {0}
run: |
python -m pip install -e .
conda list
- name: Run Tests
shell: bash -l {0}
run: |
pytest -n auto
25 changes: 0 additions & 25 deletions ci/environment-py3.7.yml

This file was deleted.

10 changes: 5 additions & 5 deletions ci/environment-upstream-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: test_env_xarrayutils
channels:
- conda-forge
dependencies:
- python=3.8
- dask
- numpy
- pytest
Expand All @@ -17,10 +16,11 @@ dependencies:
- cf_xarray
- cftime
- zarr
- pytest
- codecov
- pytest-cov
- pytest-xdist
- pip:
- git+https://github.com/pydata/xarray.git
- git+https://github.com/xgcm/xgcm.git
- pytest
- codecov
- pytest-cov
- pytest-xdist

8 changes: 3 additions & 5 deletions ci/environment-py3.8.yml → ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: test_env_xarrayutils
channels:
- conda-forge
dependencies:
- python=3.8
- xarray
- dask
- numpy
Expand All @@ -20,7 +19,6 @@ dependencies:
- cf_xarray
- cftime
- zarr
- pip:
- codecov
- pytest-cov
- pytest-xdist
- codecov
- pytest-cov
- pytest-xdist
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"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",
python_requires=">=3.8",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
long_description=long_description,
Expand Down

0 comments on commit af4ba48

Please sign in to comment.