Skip to content

Tests

Tests #494

Workflow file for this run

name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 * * 0'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
test:
needs: linting
name: ${{ matrix.os }}, ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Setup Conda
uses: mamba-org/setup-micromamba@v2
with:
# https://github.com/mamba-org/setup-micromamba/issues/225
micromamba-version: 1.5.10-0
init-shell: bash
environment-name: test
create-args: >-
python=${{ matrix.python-version }}
geopandas
numpy
netcdf4
odc-geo
pandoc
rasterio
rioxarray
scipy
xarray
- name: Install Env
shell: bash
run: |
micromamba run -n test python -m pip install -r requirements/dev.txt
micromamba run -n test python -m pip install -e .
- name: Check and Log Environment
shell: bash
run: |
micromamba run -n test python -V
micromamba run -n test python -c "import geocube; geocube.show_versions();"
micromamba info
- name: Pylint
shell: bash
run: |
micromamba run -n test python -m pylint geocube
- name: mypy
shell: bash
run: |
micromamba run -n test python -m mypy geocube/
- name: Test
shell: bash
run: |
micromamba run -n test pytest --cov-report term-missing --cov=geocube --cov-report xml
- name: Test Build docs
shell: bash
if: contains(matrix.os, 'ubuntu')
run: |
micromamba run -n test sphinx-build -b html docs/ docs/_build/
- uses: codecov/codecov-action@v4
test_latest:
needs: linting
name: Test latest dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Conda
uses: mamba-org/setup-micromamba@v2
with:
init-shell: bash
environment-name: test
create-args: >-
python=3.10
proj
libgdal
cython
netcdf4
- name: Install Env
shell: bash
run: |
micromamba run -n test python -m pip install \
--index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
--no-deps --pre --upgrade \
numpy \
pandas \
scipy;
micromamba run -n test python -m pip install --upgrade \
git+https://github.com/geopandas/pyogrio.git@main \
git+https://github.com/rasterio/rasterio.git@main \
git+https://github.com/pyproj4/pyproj.git@main \
git+https://github.com/geopandas/geopandas.git@main \
git+https://github.com/pydata/xarray.git@main \
git+https://github.com/opendatacube/odc-geo.git@develop \
git+https://github.com/corteva/rioxarray.git@master;
micromamba run -n test python -m pip install -e .[all]
micromamba run -n test python -m pip install -r requirements/test.txt
- name: Check and Log Environment
shell: bash
run: |
micromamba run -n test python -V
micromamba run -n test python -c "import geocube; geocube.show_versions();"
micromamba info
- name: Test
shell: bash
run: |
micromamba run -n test pytest --cov-report term-missing --cov=geocube --cov-report xml