Skip to content

Deploy CloudFront distributions in front of CopWatch #845

Deploy CloudFront distributions in front of CopWatch

Deploy CloudFront distributions in front of CopWatch #845

Workflow file for this run

name: test
on:
pull_request:
push:
branches: [main, develop, actions-cd]
jobs:
tests:
runs-on: ubuntu-latest
services:
postgres:
# From:
# https://docs.github.com/en/actions/guides/creating-postgresql-service-containers
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: traffic_stops
# 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
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'requirements/*/*.txt'
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y --no-install-recommends postgresql-client-14
python -m pip install pip-tools
pip-sync requirements/base/base.txt requirements/dev/dev.txt requirements/test/test.txt
- name: Create NC database
run: |
psql $DATABASE_URL -c 'CREATE DATABASE traffic_stops_nc;'
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/traffic_stops
- name: Run tests
run: |
pytest
env:
DJANGO_SETTINGS_MODULE: traffic_stops.settings.dev
DATABASE_URL: postgres://postgres:postgres@localhost:5432/traffic_stops
DATABASE_URL_NC: postgres://postgres:postgres@localhost:5432/traffic_stops_nc
- name: Test deploy image build
run: |
inv image.build