Skip to content

DTM is optional

DTM is optional #343

name: Linting and Testing
on:
push:
branches:
- master
paths:
- '**.py'
- .github/workflows/linting_and_testing.yml
pull_request:
branches:
- master
paths:
- '**.py'
- .github/workflows/linting_and_testing.yml
workflow_dispatch:
jobs:
linting:
name: Linting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff
ruff check . --fix
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: style fixes by ruff and autoformatting by black"
testing:
name: Testing${{ matrix.os }} python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.BUILD_OS)}}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
conda-remove-defaults: "true"
- name: Install dependencies for windows python 3.9 and 3.10
if: ${{ matrix.os == 'windows-latest' && (matrix.python-version == '3.9' || matrix.python-version == '3.10') }}
run: |
conda run -n test conda info
conda run -n test conda install -c loop3d -c conda-forge "gdal=3.4.3" python=${{ matrix.python-version }} -y
conda run -n test conda install -c loop3d -c conda-forge --file dependencies.txt python=${{ matrix.python-version }} -y
conda run -n test conda install pytest python=${{ matrix.python-version }} -y
- name: Install dependencies for windows python 3.11
if: ${{ matrix.os == 'windows-latest' && matrix.python-version == '3.11' }}
run: |
conda run -n test conda info
conda run -n test conda install -c loop3d -c conda-forge gdal "netcdf4=*=nompi_py311*" python=${{ matrix.python-version }} -y
conda run -n test conda install -c loop3d -c conda-forge --file dependencies.txt python=${{ matrix.python-version }} -y
conda run -n test conda install pytest python=${{ matrix.python-version }} -y
- name: Install dependencies for other environments
if: ${{ !(matrix.os == 'windows-latest' && (matrix.python-version == '3.9' || matrix.python-version == '3.10' || matrix.python-version == '3.11')) }}
run: |
conda run -n test conda info
conda run -n test conda install -c loop3d -c conda-forge python=${{ matrix.python-version }} gdal pytest --file dependencies.txt -y
- name: Install map2loop
run: |
conda run -n test python -m pip install .
- name: Run tests
run: |
conda run -n test pytest -v