Skip to content

Set environment in gha deploy proces #150

Set environment in gha deploy proces

Set environment in gha deploy proces #150

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Unit tests
on:
push:
branches: [ master ]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
env:
LANG: C.UTF-8
SECRET_KEY: secret-for-ci-only
POSTGRES_HOST: localhost
POSTGRES_NAME: ci_test
POSTGRES_PASSWORD: ci_test
POSTGRES_USER: ci_test
POSTGRES_DB: ci_test
strategy:
matrix:
python-version: ['3.8', '3.12']
django-version: ['4.2.*', '5.1.*']
psycopg: ['psycopg2-binary']
postgis-image: ['postgis/postgis:12-2.5', 'postgis/postgis:latest']
exclude:
- python-version: '3.8'
django-version: '5.1.*'
postgis-image: 'postgis/postgis:12-2.5'
- python-version: '3.12'
django-version: '5.1.*'
postgis-image: 'postgis/postgis:12-2.5'
- python-version: '3.8'
django-version: '5.1.*'
postgis-image: 'postgis/postgis:latest'
include:
- postgis-image: 'postgis/postgis:latest'
django-version: '4.2.*'
python-version: '3.12'
psycopg: ['psycopg-binary']
services:
postgres:
image: ${{ matrix.postgis-image }}
env:
POSTGRES_NAME: ci_test
POSTGRES_PASSWORD: ci_test
POSTGRES_USER: ci_test
POSTGRES_DB: ci_test
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get -yq install libproj-dev binutils gdal-bin
python3 -m pip install --upgrade pip setuptools wheel
pip install .[dev] -U
if [[ ${{ matrix.django-version }} == dev ]]; then
pip install -e git+https://github.com/django/django@master#egg=django;
else
pip install Django==${{ matrix.django-version }} -U;
fi
if [[ ${{ matrix.psycopg }} == psycopg-binary ]]; then
pip uninstall psycopg2-binary;
else
pip install psycopg2-binary -U;
fi
- name: Run migrations
run: |
python3 ./manage.py makemigrations --check
python3 ./manage.py migrate
- name: Test with coverage
run: |
coverage run ./manage.py test
- name: Coverage upload
run: |
pip install codecov
codecov