Skip to content

Tests

Tests #281

Workflow file for this run

name: Tests
on:
push:
branches: [ main, 'maint-*' ]
paths:
- '.github/workflows/tests.yml'
- 'requirements*.txt'
- 'setup.py'
- 'setup.cfg'
- 'MANIFEST.in'
- 'pyproject.toml'
- 'fiona/**'
- 'tests/**'
pull_request:
branches: [ main, 'maint-*' ]
paths:
- '.github/workflows/tests.yml'
- 'requirements*.txt'
- 'setup.py'
- 'setup.cfg'
- 'MANIFEST.in'
- 'pyproject.toml'
- 'fiona/**'
- 'tests/**'
schedule:
- cron: '0 0 * * 0'
permissions:
contents: read
jobs:
docker_tests:
runs-on: ubuntu-latest
name: Docker | GDAL=${{ matrix.gdal-version }} | python=${{ matrix.python-version }}
container: ghcr.io/osgeo/gdal:ubuntu-small-${{ matrix.gdal-version }}
env:
DEBIAN_FRONTEND: noninteractive
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
gdal-version: ['3.9.3']
include:
- python-version: '3.8'
gdal-version: '3.4.3'
- python-version: '3.9'
gdal-version: '3.5.3'
- python-version: '3.10'
gdal-version: '3.6.4'
- python-version: '3.11'
gdal-version: '3.7.3'
- python-version: '3.12'
gdal-version: '3.8.4'
- python-version: '3.12'
gdal-version: '3.9.3'
steps:
- uses: actions/checkout@v4
- name: Update
run: |
apt-get update
apt-get -y install software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update
- name: Set up Python ${{ matrix.python-version }}
run: |
apt-get install -y --no-install-recommends \
python${{ matrix.python-version }} \
python${{ matrix.python-version }}-dev \
python${{ matrix.python-version }}-venv \
python3-pip \
g++
- name: Install dependencies
run: |
python${{ matrix.python-version }} -m venv testenv
. testenv/bin/activate
python -m pip install --upgrade pip
python -m pip wheel -r requirements-dev.txt
python -m pip install -r requirements-dev.txt
python setup.py clean
python -m pip install --no-deps --force-reinstall -e .[test]
- name: Run tests
run: |
. testenv/bin/activate
python -m pytest -v -m "not wheel or gdal" -rxXs --cov fiona --cov-report term-missing
conda_test:
name: Conda | ${{ matrix.os }} | python=${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [macos-13, macos-14]
python-version: ['3.9', '3.10', '3.11', '3.12']
include:
- os: ubuntu-latest
python-version: '*'
- os: windows-latest
python-version: '3.12'
steps:
- uses: actions/checkout@v4
- name: Setup Conda
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.10-0'
init-shell: >-
bash
powershell
environment-name: test
create-args: >-
python=${{ matrix.python-version }}
libgdal=3.9
geos>=3.12
cython=3
numpy
- name: Install Env
if: matrix.os != 'windows-latest'
shell: bash -l {0}
run: |
micromamba run -n test python -m pip install -e . --no-use-pep517 || micromamba run -n test python -m pip install -e .
micromamba run -n test python -m pip install -r requirements-dev.txt
- name: Install Env (Windows)
if: matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
GDAL_VERSION="3.9.3" micromamba run -n test python setup.py build_ext -I"$MAMBA_ROOT_PREFIX/envs/test/Library/include" -lgdal -L"$MAMBA_ROOT_PREFIX/envs/test/Library/lib" install
micromamba run -n test python -m pip install -r requirements-dev.txt
rm -rf fiona
- name: Check and Log Environment
shell: bash -l {0}
run: |
micromamba run -n test python -V
micromamba info
- name: Test with Coverage (Ubuntu)
if: matrix.os == 'ubuntu-latest'
shell: bash -l {0}
run: |
micromamba run -n test python -m pytest -v -m "not wheel" -rxXs --cov fiona --cov-report term-missing
- name: Test with Coverage (Windows)
if: matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
micromamba run -n test python -m pytest -v -m "not wheel" -rxXs --cov fiona --cov-report term-missing
- name: Test with Coverage (OSX)
if: "${{matrix.os}} == 'macos-13' || ${{matrix.os}} == 'macos-14'"
shell: bash -l {0}
run: |
micromamba run -n test python -m pytest -v -m "not wheel" -rxXs --cov fiona --cov-report term-missing