File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Django Tests
2+
3+ on :
4+ push :
5+ branches : [ master ]
6+ workflow_dispatch :
7+
8+ jobs :
9+ test :
10+ runs-on : ubuntu-latest
11+
12+ services :
13+ postgres :
14+ image : postgres:15
15+ env :
16+ POSTGRES_DB : django_test
17+ POSTGRES_USER : postgres
18+ POSTGRES_PASSWORD : postgres
19+ options : >-
20+ --health-cmd pg_isready
21+ --health-interval 10s
22+ --health-timeout 5s
23+ --health-retries 5
24+ ports :
25+ - 5432:5432
26+
27+ steps :
28+ - name : Checkout code
29+ uses : actions/checkout@v4
30+
31+ - name : Build Docker image
32+ run : docker build -t dri-test .
33+
34+ - name : Wait for PostgreSQL to be ready
35+ run : |
36+ until pg_isready -h localhost -U postgres; do
37+ echo "Waiting for PostgreSQL..."
38+ sleep 5
39+ done
40+
41+ - name : Run Django tests
42+ run : |
43+ docker run --rm \
44+ --network host \
45+ -e DATABASE_URL=postgres://postgres:postgres@localhost:5432/django_test \
46+ -e SECRET_KEY=test-secret-key-for-github-actions-only \
47+ -e DEBUG=True \
48+ -e BASE_URL=http://localhost:8000 \
49+ -e AWS_ACCESS_KEY_ID=test-access-key \
50+ -e AWS_SECRET_ACCESS_KEY=test-secret-key \
51+ -e AWS_STORAGE_BUCKET_NAME=testbucket \
52+ -e AWS_S3_REGION_NAME=us-east-1 \
53+ -e AWS_S3_ENDPOINT_URL=http://localhost:9000 \
54+ -e AWS_S3_USE_SSL=false \
55+ -e EMAIL_URL=smtp://localhost:1025 \
56+ -e DEFAULT_FROM_EMAIL=test@localhost \
57+ -e DO_MIGRATIONS=false \
58+ -e DO_COLLECTSTATIC=false \
59+ -e REDDIT_CLIENT_ID=test-client-id \
60+ -e REDDIT_CLIENT_SECRET=test-client-secret \
61+ dri-test \
62+ python manage.py test
You can’t perform that action at this time.
0 commit comments