Skip to content

Feature/environment data app #430

Feature/environment data app

Feature/environment data app #430

Workflow file for this run

name: Service Map API tests
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
jobs:
build:
# Ubuntu latest is Ubuntu 20.04 as of 2022/6
runs-on: ubuntu-20.04
env:
# Database for tests
DATABASE_URL: postgis://postgres:postgres@localhost/smbackend
ADDITIONAL_INSTALLED_APPS: smbackend_turku,ptv
PTV_ID_OFFSET: 10000000
LAM_COUNTER_API_BASE_URL: https://tie.digitraffic.fi/api/tms/v1/history
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10.0
uses: actions/setup-python@v3
with:
python-version: 3.10.0
- name: Install required Ubuntu packages
run: |
sudo apt-get install gdal-bin
sudo apt-get install voikko-fi
sudo apt-get install libvoikko-dev
- name: Create needed postgis extensions
run: |
psql -h localhost -U postgres template1 -c 'create extension hstore;'
psql -h localhost -U postgres template1 -c 'create extension pg_trgm;'
- name: Install PyPI dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Python side code neatness tests
run: |
flake8
black --check .
isort . -c
- name: Run pytest code functionality tests
run: |
pytest --cov=.
- name: Generate Report
run: |
pip install coverage
coverage report -m
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
# Majority of the tests require database
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgis/postgis:13-3.1
# Provide the password for postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432