rename PR template so it is the default always #43
Workflow file for this run
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
# Runs the Pytest test suite when PRs are made against any branch | |
name: Run Pytest on all PRs | |
on: | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
build-and-run-pytest-suite: | |
runs-on: ubuntu-latest | |
# this 'env' refers to environment variables | |
env: | |
DJANGO_CSRF_TRUSTED_ORIGINS: https://localhost,https://0.0.0.0 | |
E12_POSTGRES_DB_HOST: 127.0.0.1 | |
E12_POSTGRES_DB_NAME: test_db | |
E12_POSTGRES_DB_PASSWORD: postgis | |
E12_POSTGRES_DB_PORT: 5432 | |
E12_POSTGRES_DB_USER: postgis | |
POSTCODE_API_BASE_URL: https://findthatpostcode.uk | |
RCPCH_CENSUS_PLATFORM_TOKEN: ${{ secrets.RCPCH_CENSUS_PLATFORM_TOKEN }} | |
RCPCH_CENSUS_PLATFORM_URL: https://api.rcpch.ac.uk/deprivation/v1 | |
RCPCH_HERMES_SERVER_URL: http://rcpch-hermes.uksouth.azurecontainer.io:8080/v1/snomed | |
# Sets up a Postgis container for the test db | |
services: | |
postgis: | |
image: postgis/postgis:15-3.3 | |
env: | |
POSTGRES_USER: postgis | |
POSTGRES_PASSWORD: postgis | |
POSTGRES_DB: test_db | |
ports: | |
- 5432:5432 | |
# needed because the postgis container does not provide a healthcheck | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
# Creates git_hash.txt file current commit hash | |
- name: Get Hash | |
id: hash | |
run: echo "GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}),GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")" > git_hash.txt | |
- name: Set up Python version | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install PostGIS dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y binutils libproj-dev gdal-bin libgdal-dev python3-gdal | |
- name: Create and start virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
# python dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
# Required for tests which read template content | |
- name: collect static files | |
run: python manage.py collectstatic --noinput | |
# Runs tests | |
- name: Pytest Suite | |
run: pytest -rP | |