File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+
2+ name : Backend Tests
3+
4+ on :
5+ push :
6+ branches : [main]
7+ pull_request :
8+ branches : [main]
9+
10+ jobs :
11+ test :
12+ runs-on : ubuntu-latest
13+
14+ services :
15+ postgres :
16+ image : timescale/timescaledb:latest-pg16
17+ env :
18+ POSTGRES_USER : netsentry
19+ POSTGRES_PASSWORD : testpassword
20+ POSTGRES_DB : netsentry_test
21+ ports :
22+ - 5432:5432
23+ options : >-
24+ --health-cmd pg_isready
25+ --health-interval 10s
26+ --health-timeout 5s
27+ --health-retries 5
28+
29+ steps :
30+ - name : Check out code
31+ uses : actions/checkout@v4
32+
33+ - name : Set up Python
34+ uses : actions/setup-python@v5
35+ with :
36+ python-version : ' 3.13'
37+
38+ - name : Install dependencies
39+ working-directory : backend
40+ run : |
41+ pip install -r requirements.txt
42+
43+ - name : Apply database schema
44+ working-directory : backend
45+ env :
46+ PGPASSWORD : testpassword
47+ run : |
48+ psql -h localhost -U netsentry -d netsentry_test -f schema.sql
49+
50+ - name : Run tests
51+ working-directory : backend
52+ env :
53+ DB_HOST : localhost
54+ DB_PORT : 5432
55+ DB_NAME : netsentry_test
56+ DB_USER : netsentry
57+ DB_PASSWORD : testpassword
58+ TEST_DB_NAME : netsentry_test
59+ JWT_SECRET_KEY : test-secret-key-for-ci-only
60+ JWT_ALGORITHM : HS256
61+ JWT_EXPIRE_MINUTES : 60
62+ MQTT_BROKER_HOST : localhost
63+ MQTT_BROKER_PORT : 1883
64+ TESTING : ' 1'
65+ run : |
66+ pytest tests/ -v
67+
You can’t perform that action at this time.
0 commit comments