Merge pull request #63 from City-of-Turku/feature/postal_code_result_… #177
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Mobility Profile API tests | |
on: | |
push: | |
branches: [ master, develop ] | |
pull_request: | |
branches: [ master, develop ] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
env: | |
# Database for tests | |
DATABASE_URL: postgres://postgres:postgres@localhost/mobilityprofile | |
TOKEN_SECRET: dgj533GDG242fdsM | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10.4 | |
- name: Install required Ubuntu packages | |
run: | | |
sudo apt-get update && sudo apt-get install gdal-bin | |
- 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@v4 | |
# 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 |