-
Notifications
You must be signed in to change notification settings - Fork 19
73 lines (67 loc) · 2.08 KB
/
backend-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Backend tests
on:
push:
branches:
- main
pull_request:
paths:
- "backend/**/*"
- "backend/*"
- ".github/workflows/backend-test.yml"
jobs:
unit-tests:
runs-on: ubuntu-24.04
defaults:
run:
working-directory: backend
services:
postgres:
image: postgres:14.5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432/tcp
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:7.2.3
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11.6"
- name: Install uv
uses: astral-sh/setup-uv@v4
id: setup-uv
with:
version: "0.5.5"
enable-cache: true
- run: pip install codecov
- name: Install python dependencies
if: steps.setup-uv.outputs.cache-hit != 'true'
run: uv sync
- name: pytest
run: |
set +e
CPUS=$(nproc --all)
OUTPUT=$(uv run pytest --cov-report xml --cov=. --cov-fail-under 80 --durations 10 -n $CPUS)
STATUS=$?
echo "$OUTPUT"
cd ..
codecov
exit $STATUS
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:${{ job.services.postgres.ports['5432'] }}/postgres
CACHE_URL: redis://localhost:6379/0
CELERY_BROKER_URL: redis://redis:6379/1
CELERY_RESULT_BACKEND: redis://redis:6379/2
STRIPE_SECRET_API_KEY: fake-key
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
MEDIA_FILES_STORAGE_BACKEND: django.core.files.storage.FileSystemStorage
STRIPE_SUBSCRIPTION_PRICE_ID: ""
STRIPE_WEBHOOK_SIGNATURE_SECRET: ""