Skip to content

closes #496 #494 #493 #491 #490 #1

closes #496 #494 #493 #491 #490

closes #496 #494 #493 #491 #490 #1

Workflow file for this run

name: pytest
on:
push:
branches:
- master
- hotfixes
- develop
pull_request:
branches:
- master
- hotfixes
- develop
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
debian-version: [ '11', '12' ]
sqlalchemy-version: [ '1.4' ]
include:
- debian-version: '11'
python-version: '3.9'
postgres-version: '13'
postgis-version: '3.2'
- debian-version: '12'
python-version: '3.11'
postgres-version: '15'
postgis-version: '3.3'
name: Debian ${{ matrix.debian-version }} - SQLAlchemy ${{ matrix.sqlalchemy-version }}
services:
postgres:
image: postgis/postgis:${{ matrix.postgres-version }}-${{ matrix.postgis-version }}
env:
POSTGRES_DB: taxhub
POSTGRES_USER: taxhubadmin
POSTGRES_PASSWORD: taxhubpwd
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Add postgis_raster database extension
if: ${{ matrix.postgis-version >= 3 }}
run: |
psql -h localhost -U taxhubadmin -d taxhub -tc 'CREATE EXTENSION "postgis_raster";'
env:
PGPASSWORD: taxhubpwd
- name: Add database extensions
run: |
psql -h localhost -U taxhubadmin -d taxhub -tc 'CREATE EXTENSION "unaccent";'
psql -h localhost -U taxhubadmin -d taxhub -tc 'CREATE EXTENSION "uuid-ossp";'
psql -h localhost -U taxhubadmin -d taxhub -tc 'CREATE EXTENSION "pg_trgm";'
env:
PGPASSWORD: taxhubpwd
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install GDAL
run: |
sudo apt update
sudo apt install -y libgdal-dev
- name: Install dependencies
if: ${{ matrix.sqlalchemy-version == '1.4' }}
run: |
python -m pip install --upgrade pip
python -m pip install \
-e .[tests] \
-r requirements-dev.in
- name: Install database
run: |
flask db upgrade taxhub@head -x local-srid=2154
flask db upgrade taxhub-admin@head
flask db upgrade ref_geo_fr_departments@head
flask db autoupgrade
flask db status
env:
TAXHUB_SETTINGS: test_config.py
- name: Install taxref
run: |
flask taxref import-v17
env:
TAXHUB_SETTINGS: test_config.py
- name: Test with pytest
run: |
pytest -v --cov --cov-report xml
env:
TAXHUB_SETTINGS: test_config.py
- name: Upload coverage to Codecov
if: ${{ matrix.name == '11' && matrix.sqlalchemy-version == '1.4' }}
uses: codecov/codecov-action@v3
with:
flags: pytest