Skip to content

Add test action

Add test action #2

Workflow file for this run

name: Python tests
on:
push:
branches: [ main ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
services:
postgis:
image: postgis/postgis:15-3.3
env:
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
python-version: [3.9, '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v2
- name: Install System Dependencies
run: |
sudo apt-get update && sudo apt-get install -y build-essential git curl
pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python Dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install
poetry run pip install tox
- name: Set up database
run: |
psql -c 'CREATE ROLE django SUPERUSER LOGIN CREATEDB;' -U postgres
psql -c 'CREATE ROLE travis SUPERUSER LOGIN CREATEDB;' -U postgres
psql -c 'CREATE DATABASE test_pg_database;' -U postgres
psql -c 'CREATE EXTENSION postgis;' -U postgres -d test_pg_database
psql -c 'CREATE EXTENSION postgis_topology;' -U postgres -d test_pg_database
- name: Run Tests
run: |
cd server
TOXENV=django poetry run tox
TOXENV=nodjango poetry run tox