-
Notifications
You must be signed in to change notification settings - Fork 6
139 lines (120 loc) · 4.66 KB
/
Copy pathci.yml
File metadata and controls
139 lines (120 loc) · 4.66 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
PYTHON_VERSION: "3.12"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install ruff
run: pip install ruff
- name: Run ruff (syntax and critical errors only)
run: |
ruff check . --select E9,F63,F7,F82 --no-fix
echo "Syntax and critical error check: PASS"
- name: Run ruff full check (informational)
continue-on-error: true
run: ruff check . --statistics 2>&1 | tail -25
test:
name: Unit Tests
runs-on: ubuntu-latest
needs: lint
env:
# Auth / JWT
AUTH_SECRET_KEY: ci-test-secret-key-minimum-32-characters-long!!
SECURITY_JWT_SECRET: ci-test-secret-key-minimum-32-characters-long!!
USER_SERVICE_JWT_SECRET_KEY: ci-test-secret-key-minimum-32-characters-long!!
# Encryption
ENCRYPTION_MASTER_KEY: ci-test-encrypt-key-exactly-32ch
USER_SERVICE_FIELD_ENCRYPTION_KEY: ci-test-encrypt-key-exactly-32ch
FERNET_TOKEN_KEY: sp1gRbNPAdgva1NX4vYC3gZDNu--cUiGM5H9xhtltN8=
FERNET_FIELD_KEY: aQyP7tOjb06jmhH0Ni3Y04CqcrzrnK_KnuurAOUWl4c=
# Database
POSTGRES_PASSWORD: ci_test_password
USER_DB_PASSWORD: ci_test_password
# Service Auth
SERVICE_AUTH_SERVICE_SECRET: ci-test-service-secret-for-auth-32chars!!
# Runtime
ENVIRONMENT: test
KAFKA_ENABLED: "false"
LOG_LEVEL: WARNING
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
pip install pytest-mock pytest-asyncio httpx
- name: Verify imports and syntax
run: pytest tests/test_syntax_and_imports.py -x -q --no-header
- name: Run alignment tests
run: pytest tests/alignment/ -x -q --no-header
- name: Run shared library tests
continue-on-error: true
run: |
pytest tests/solace_common/ -x -q --no-header 2>&1 || true
pytest tests/solace_security/ -x -q --no-header 2>&1 || true
- name: Run service unit tests
continue-on-error: true
run: |
pytest services/safety_service/tests/ -q --no-header --ignore=services/safety_service/tests/test_api.py 2>&1 || true
pytest services/diagnosis_service/tests/ -q --no-header 2>&1 || true
pytest services/therapy_service/tests/ -q --no-header 2>&1 || true
pytest services/memory_service/tests/ -q --no-header 2>&1 || true
pytest services/personality_service/tests/ -q --no-header 2>&1 || true
- name: Run integration tests
continue-on-error: true
run: pytest tests/integration/ -q --no-header 2>&1 || true
docker-build:
name: Docker Build
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
service:
- { context: "./services/user-service", name: "user-service" }
- { context: "./services/safety_service", name: "safety-service" }
- { context: "./services/notification-service", name: "notification-service" }
- { context: "./services/diagnosis_service", name: "diagnosis-service" }
- { context: "./services/memory_service", name: "memory-service" }
- { context: "./services/therapy_service", name: "therapy-service" }
- { context: "./services/personality_service", name: "personality-service" }
- { context: "./services/orchestrator_service", name: "orchestrator-service" }
- { context: "./services/analytics-service", name: "analytics-service" }
- { context: "./services/config_service", name: "config-service" }
steps:
- uses: actions/checkout@v4
- name: Check Dockerfile exists
id: check
run: |
if [ -f "${{ matrix.service.context }}/Dockerfile" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "::warning::No Dockerfile found for ${{ matrix.service.name }}"
fi
- name: Build Docker image
if: steps.check.outputs.exists == 'true'
run: |
docker build \
--tag solace-ai/${{ matrix.service.name }}:ci \
${{ matrix.service.context }}