-
Notifications
You must be signed in to change notification settings - Fork 124
85 lines (81 loc) · 2.31 KB
/
hamilton-ui-backend.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
74
75
76
77
78
79
80
81
82
83
84
85
name: Backend Test Workflow
on:
push:
branches:
- main # or any specific branches you want to include
paths:
- 'ui/backend/**'
pull_request:
branches:
- main
paths:
- 'ui/backend/**'
jobs:
test-backend:
runs-on: ubuntu-latest
strategy:
matrix:
testdir: [test_lifecycle, test_db_methods] # Specify your test directories
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_DB: circleci_test
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 100s
--health-retries 10
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
cd ui/backend/server
pip install -r requirements-base.txt
pip install -r requirements-test.txt
- name: Run migrations
env:
DB_HOST: localhost
DB_USER: postgres
DB_PASSWORD: "postgres"
DB_NAME: ${{ matrix.testdir }}
DB_PORT: 5432
HAMILTON_ENV: integration_tests
DJANGO_SECRET_KEY: test
PGPASSWORD: postgres
PGHOST: localhost
PGUSER: postgres
HAMILTON_BLOB_STORE: local
HAMILTON_LOCAL_BLOB_DIR: ./blob_data
HAMILTON_AUTH_MODE: integration_tests
run: |
cd ui/backend/server
python manage.py sqlcreate
echo $(python manage.py sqlcreate) | psql -U postgres
python manage.py migrate
- name: Run tests
env:
DB_HOST: localhost
DB_USER: postgres
DB_PASSWORD: "postgres"
DB_NAME: ${{ matrix.testdir }}
DB_PORT: 5432
HAMILTON_ENV: integration_tests
DJANGO_SECRET_KEY: test
PGPASSWORD: postgres
PGHOST: localhost
PGUSER: postgres
HAMILTON_BLOB_STORE: local
HAMILTON_LOCAL_BLOB_DIR: ./blob_data
HAMILTON_AUTH_MODE: integration_tests
run: |
cd ui/backend/server
python -m pytest tests/${{ matrix.testdir }} -vvvvv