Skip to content

CI

CI #251

Workflow file for this run

name: CI
on:
push:
branches: [stable, develop]
pull_request:
branches: [stable, develop]
workflow_dispatch:
schedule:
- cron: "0 12 * * 1"
jobs:
test:
name: Test
runs-on: ubuntu-latest
if: github.repository == 'noaa-oar-arl/monet'
strategy:
matrix:
python-version: ["3.6", "3.8", "3.10"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up Python (micromamba)
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
- name: Downgrades if on Python 3.6
if: matrix.python-version == '3.6'
run: micromamba install cf_xarray=0.6.3 attrs=22.2.0
- name: Ensure xesmf>=0.7 if not on Python 3.6
if: matrix.python-version != '3.6'
run: |
update_needed=$(python -c "
import sys
from packaging.version import Version
try:
import xesmf as xe
except ImportError as e:
print(e, file=sys.stderr)
print('y')
raise SystemExit()
v = Version(getattr(xe, '__version__', '0.0.0'))
print(v, file=sys.stderr)
print('n' if v >= Version('0.7') else 'y')
")
if [[ $update_needed == 'y' ]]; then
micromamba install 'xesmf>=0.7'
fi
- name: Install package
run: python -m pip install -e . --no-deps
- name: Test with pytest
run: pytest -v
docs:
name: Check docs build
runs-on: ubuntu-latest
if: github.repository == 'noaa-oar-arl/monet'
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up Python (micromamba)
uses: mamba-org/setup-micromamba@v1
with:
environment-file: docs/environment-docs.yml
cache-environment: true
- name: linkcheck
run: sphinx-build -b linkcheck docs docs/_build/linkcheck
- name: sphinx-build -W
run: sphinx-build -b html -W docs docs/_build/html