-
Notifications
You must be signed in to change notification settings - Fork 92
101 lines (90 loc) · 2.67 KB
/
Copy pathdjango.yml
File metadata and controls
101 lines (90 loc) · 2.67 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Django Backend CI
on:
push:
branches: [main, dev]
paths:
- 'django-backend/**'
- '.github/workflows/django.yml'
pull_request:
branches: [main, dev]
paths:
- 'django-backend/**'
- '.github/workflows/django.yml'
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: soroscan_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: 'django-backend/requirements.txt'
- name: Install dependencies
working-directory: ./django-backend
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Run pytest with coverage
working-directory: ./django-backend
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/soroscan_test
REDIS_URL: redis://localhost:6379/0
SECRET_KEY: test-secret-key-for-ci
DEBUG: 'False'
DJANGO_SETTINGS_MODULE: soroscan.settings_test
SOROBAN_RPC_URL: ''
run: |
python -m pytest \
--cov=soroscan \
--cov-report=xml \
--cov-report=term-missing \
--cov-report=html \
--cov-report=json \
--cov-fail-under=70
- name: Upload HTML coverage report as artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: backend-coverage-html
path: django-backend/htmlcov/
retention-days: 30
- name: Upload coverage to Codecov
if: always()
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./django-backend/coverage.xml
flags: backend
name: backend-coverage
fail_ci_if_error: false
- name: Lint with ruff
working-directory: ./django-backend
run: |
python -m ruff check .
# Continue on error to report all issues
continue-on-error: false