mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-25 07:49:37 +02:00
Merge pull request #558 from lkiesow/test
Basic Integration Test for backend
This commit is contained in:
commit
a974c8c275
2 changed files with 77 additions and 0 deletions
16
.github/.docker-compose-database.yml
vendored
Normal file
16
.github/.docker-compose-database.yml
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
services:
|
||||
db:
|
||||
image: postgis/postgis:15-3.3
|
||||
container_name: adventurelog-db
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:5432:5432"
|
||||
environment:
|
||||
POSTGRES_DB: database
|
||||
POSTGRES_USER: adventure
|
||||
POSTGRES_PASSWORD: changeme123
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data/
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
61
.github/workflows/backend-test.yml
vendored
Normal file
61
.github/workflows/backend-test.yml
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
name: Test Backend
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'backend/server/**'
|
||||
- '.github/workflows/backend-test.yml'
|
||||
push:
|
||||
paths:
|
||||
- 'backend/server/**'
|
||||
- '.github/workflows/backend-test.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: set up python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
sudo apt update -q
|
||||
sudo apt install -y -q \
|
||||
python3-gdal
|
||||
|
||||
- name: start database
|
||||
run: |
|
||||
docker compose -f .github/.docker-compose-database.yml up -d
|
||||
|
||||
- name: install python libreries
|
||||
working-directory: backend/server
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: run server
|
||||
working-directory: backend/server
|
||||
env:
|
||||
PGHOST: "127.0.0.1"
|
||||
PGDATABASE: "database"
|
||||
PGUSER: "adventure"
|
||||
PGPASSWORD: "changeme123"
|
||||
SECRET_KEY: "changeme123"
|
||||
DJANGO_ADMIN_USERNAME: "admin"
|
||||
DJANGO_ADMIN_PASSWORD: "admin"
|
||||
DJANGO_ADMIN_EMAIL: "admin@example.com"
|
||||
PUBLIC_URL: "http://localhost:8000"
|
||||
CSRF_TRUSTED_ORIGINS: "http://localhost:5173,http://localhost:8000"
|
||||
DEBUG: "True"
|
||||
FRONTEND_URL: "http://localhost:5173"
|
||||
run: |
|
||||
python manage.py migrate
|
||||
python manage.py runserver &
|
||||
|
||||
- name: wait for backend to boot
|
||||
run: >
|
||||
curl -fisS --retry 60 --retry-delay 1 --retry-all-errors
|
||||
http://localhost:8000/
|
Loading…
Add table
Add a link
Reference in a new issue