-
Notifications
You must be signed in to change notification settings - Fork 1
194 lines (156 loc) · 5.17 KB
/
Copy pathpr-tests.yml
File metadata and controls
194 lines (156 loc) · 5.17 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: PR Tests (No Secrets Required)
on:
pull_request:
branches: [main, develop]
paths:
- "ushadow/backend/**"
- "ushadow/frontend/**"
- "robot_tests/**"
- ".github/workflows/pr-tests.yml"
# Allow manual trigger for testing
workflow_dispatch:
jobs:
backend-unit-tests:
name: Backend Unit Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ushadow/backend
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
uv pip install --system -e ".[dev]"
- name: Run stable tests (no secrets required)
env:
CI: "true"
SKIP_INTEGRATION: "false"
run: |
# Run all tests except those requiring secrets or TDD tests
pytest -m "not (requires_secrets or tdd)" --cov=src --cov-report=xml --cov-report=term
- name: Run TDD tests (allowed to fail)
env:
CI: "true"
SKIP_INTEGRATION: "false"
run: |
# Run TDD tests separately - these are expected to fail
pytest -m "tdd" --verbose || echo "TDD tests failed as expected"
continue-on-error: true
- name: Upload coverage reports
uses: codecov/codecov-action@v4
if: always()
with:
files: ./ushadow/backend/coverage.xml
flags: backend-unit
name: backend-coverage
frontend-build:
name: Frontend Build Check
runs-on: ubuntu-latest
defaults:
run:
working-directory: ushadow/frontend
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: ushadow/frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Run TypeScript type check
run: npm run type-check
- name: Run linter
run: npm run lint
- name: Build frontend
run: npm run build
# Separate job for tests requiring secrets (only runs when explicitly triggered)
backend-integration-tests:
name: Backend Integration Tests (Secrets Required)
runs-on: ubuntu-latest
# Only run on workflow_dispatch or when explicitly requested
if: github.event_name == 'workflow_dispatch'
defaults:
run:
working-directory: ushadow/backend
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
uv pip install --system -e ".[dev]"
- name: Start test services
run: |
docker compose -f ../../docker-compose.test.yml up -d mongodb redis
- name: Wait for services
run: |
timeout 60 bash -c 'until docker compose -f ../../docker-compose.test.yml ps | grep -q "healthy"; do sleep 2; done'
- name: Run integration tests
env:
CI: "true"
RUN_SECRET_TESTS: "true"
# Add your secret env vars here when running manually
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
pytest -m "requires_secrets or integration" --cov=src --cov-report=xml
- name: Cleanup services
if: always()
run: |
docker compose -f ../../docker-compose.test.yml down -v
robot-tests:
name: Robot Framework Tests (Secrets Required)
runs-on: ubuntu-latest
# Only run on workflow_dispatch or when explicitly requested
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Robot Framework dependencies
working-directory: robot_tests
run: |
pip install -r requirements.txt
- name: Start backend services
run: |
docker compose up -d mongodb redis backend
- name: Wait for backend to be healthy
run: |
timeout 60 bash -c 'until curl -f http://localhost:8080/health; do sleep 2; done'
- name: Run Robot Framework tests
working-directory: robot_tests
env:
TAILSCALE_AUTH_KEY: ${{ secrets.TAILSCALE_AUTH_KEY }}
TAILSCALE_API_KEY: ${{ secrets.TAILSCALE_API_KEY }}
run: |
robot --outputdir . tests/
- name: Upload Robot test results
uses: actions/upload-artifact@v4
if: always()
with:
name: robot-test-results
path: |
robot_tests/log.html
robot_tests/report.html
robot_tests/output.xml
- name: Cleanup services
if: always()
run: |
docker compose down -v