Skip to content

Fix pytest during PRs #1608

Fix pytest during PRs

Fix pytest during PRs #1608

Workflow file for this run

name: pytest
on:
# Run tests on all pushed branches
push:
branches:
- "*"
# Run tests on PR, prior to merge to main & development.
pull_request:
branches:
- main
- staging
- development
# Allow manual trigger (workflow_dispatch)
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
environment:
name: development
container:
image: ghcr.io/hotosm/fmtm/backend:ci-${{ github.event_name == 'push' && github.ref_name || github.base_ref }}
env:
ODK_CENTRAL_URL: https://central-proxy
ODK_CENTRAL_USER: [email protected]
ODK_CENTRAL_PASSWD: odk
OSM_CLIENT_ID: test
OSM_CLIENT_SECRET: test
OSM_SECRET_KEY: test
# Fix why env. vars not working below
# OSM_CLIENT_ID: ${{ env.OSM_TEST_CLIENT_ID }}
# OSM_CLIENT_SECRET: ${{ env.OSM_TEST_CLIENT_SECRET }}
# OSM_SECRET_KEY: ${{ env.OSM_TEST_SECRET_KEY }}
# FRONTEND_MAIN_URL: "ui-main:8080"
# FRONTEND_MAP_URL: "ui-map:8081"
options: --user root
services:
# Start backend database
fmtm-db:
image: postgis/postgis:14-3.3-alpine
env:
POSTGRES_PASSWORD: fmtm
POSTGRES_DB: fmtm
POSTGRES_USER: fmtm
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Start ODK Central database
central-db:
image: "postgis/postgis:14-3.3-alpine"
env:
POSTGRES_PASSWORD: odk
POSTGRES_DB: odk
POSTGRES_USER: odk
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Start ODK Central
central:
image: "ghcr.io/hotosm/fmtm/odkcentral:v2023.2.1"
env:
DOMAIN: local
SYSADMIN_EMAIL: [email protected]
SYSADMIN_PASSWD: odk
HTTPS_PORT: 443
DB_HOST: central-db
DB_USER: odk
DB_PASSWORD: odk
DB_NAME: odk
SENTRY_ORG_SUBDOMAIN: o130137
SENTRY_KEY: 3cf75f54983e473da6bd07daddf0d2ee
SENTRY_PROJECT: 1298632
# Start proxy to access ODK Central
central-proxy:
image: "ghcr.io/hotosm/fmtm/odkcentral-proxy:latest"
steps:
- uses: actions/checkout@v3
- name: Run pytest as appuser
run: |
cd src/backend
gosu appuser pytest