Skip to content

fix: Set environment variable for DATABASE_URL #2

fix: Set environment variable for DATABASE_URL

fix: Set environment variable for DATABASE_URL #2

Workflow file for this run

name: Run Django Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd server
pip install -r requirements.txt
- name: Set environment variable for DATABASE_URL
run: echo "DATABASE_URL=postgres://postgres:postgres@localhost:5432/test_db" >> $GITHUB_ENV
- name: Apply migrations
run: |
cd server
python manage.py migrate
- name: Run tests
run: |
cd server
python manage.py test