Skip to content

Commit dafa380

Browse files
committed
Test CI workflow
1 parent 47ec842 commit dafa380

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

.env.ci

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Database
2+
DATABASE_URI=postgresql://postgres:postgres@localhost:5432/web
3+
DATABASE_URI_TEST=postgresql://postgres:postgres@localhost:5432/web_test
4+
5+
# Django
6+
SECRET_KEY=ci-secret-key
7+
DEBUG=False
8+
ALLOWED_HOSTS=localhost,127.0.0.1
9+
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
10+
11+
# Celery / Redis
12+
CELERY_BROKER_URL=redis://localhost:6379/0
13+
CELERY_RESULT_BACKEND=redis://localhost:6379/1
14+
15+
# Postgres
16+
POSTGRES_USER=postgres
17+
POSTGRES_PASSWORD=postgres
18+
POSTGRES_DB=postgres

.github/workflows/django-ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
jobs:
2+
test:
3+
runs-on: ubuntu-latest
4+
services:
5+
postgres:
6+
image: postgres:15
7+
env:
8+
POSTGRES_USER: postgres
9+
POSTGRES_PASSWORD: postgres
10+
POSTGRES_DB: web_test
11+
ports: ["5432:5432"]
12+
options: >-
13+
--health-cmd="pg_isready -U postgres"
14+
--health-interval=10s
15+
--health-timeout=5s
16+
--health-retries=5
17+
18+
redis:
19+
image: redis:7
20+
ports: ["6379:6379"]
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.11"
29+
30+
- name: Install dependencies
31+
run: |
32+
pip install -r requirements.txt
33+
34+
- name: Load CI environment variables
35+
run: |
36+
set -o allexport
37+
source .env.ci
38+
set +o allexport
39+
40+
- name: Run migrations
41+
run: python manage.py migrate
42+
43+
- name: Run tests
44+
run: pytest

0 commit comments

Comments
 (0)