forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (155 loc) · 6.98 KB
/
Copy pathbackend-unit-tests.yml
File metadata and controls
166 lines (155 loc) · 6.98 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
name: Backend Unit Tests
on:
push:
branches:
- main
paths:
- '.gitignore'
- 'backend/**'
- 'package.json'
- 'package-lock.json'
- 'config/deployment-setting-classification.json'
- 'firestore.indexes.json'
- '.github/actions/detect-changes/**'
- '.github/actions/deploy-backend-stack/**'
- '.github/actions/release-eligibility/action.yml'
- '.github/actions/transcription-release-candidate-probe/**'
- '.github/workflows/backend-checks.yml'
- '.github/workflows/backend-hermetic-e2e.yml'
- '.github/workflows/backend-unit-tests.yml'
- '.github/workflows/desktop-checks.yml'
- '.github/workflows/desktop-swift-ci.yml'
- '.github/workflows/desktop_backend_auto_dev.yml'
- '.github/workflows/desktop_backend_prod.yml'
- '.github/workflows/repo-checks.yml'
- '.github/workflows/release-eligibility.yml'
- '.github/workflows/desktop_promote_beta.yml'
- '.github/workflows/desktop_rollback_beta.yml'
- '.github/workflows/desktop_breakglass_rollout_beta.yml'
- '.github/workflows/desktop_beta_admission_control.yml'
- '.github/workflows/desktop_promote_prod.yml'
- '.github/workflows/gcp_backend.yml'
- '.github/workflows/gcp_backend_auto_dev.yml'
- '.github/workflows/gcp_cloud_run_metrics_egress.yml'
- '.github/workflows/gcp_firestore_indexes.yml'
- '.github/workflows/gcp_backend*.yml'
- '.github/workflows/gcp_llm_gateway.yml'
- '.github/workflows/gcp_memory_maintenance_job.yml'
- '.github/workflows/gcp_memory_maintenance_job_auto_dev.yml'
- '.github/workflows/gcp_notifications_job.yml'
- '.github/scripts/check_backend_deploy_source_admission.py'
- '.github/scripts/verify_auto_backend_release_admission.py'
- '.github/scripts/verify_backend_release_admission.py'
- '.github/scripts/verify_release_eligibility.py'
- '.github/workflows/sync_ledger_fence_cutover.yml'
- 'scripts/changed-files'
- 'scripts/install-git-hooks.sh'
- 'scripts/pre-push'
- 'scripts/pre-push-singleflight'
- 'scripts/dev-harness/dev_harness/jit_vertex_gateway.py'
- 'scripts/voice-provider-probe.sh'
pull_request:
paths:
- '.gitignore'
- 'backend/**'
- 'package.json'
- 'package-lock.json'
- 'config/deployment-setting-classification.json'
- 'firestore.indexes.json'
- '.github/actions/detect-changes/**'
- '.github/actions/deploy-backend-stack/**'
- '.github/actions/release-eligibility/action.yml'
- '.github/actions/transcription-release-candidate-probe/**'
- '.github/workflows/backend-checks.yml'
- '.github/workflows/backend-hermetic-e2e.yml'
- '.github/workflows/backend-unit-tests.yml'
- '.github/workflows/desktop-checks.yml'
- '.github/workflows/desktop-swift-ci.yml'
- '.github/workflows/desktop_backend_auto_dev.yml'
- '.github/workflows/desktop_backend_prod.yml'
- '.github/workflows/repo-checks.yml'
- '.github/workflows/release-eligibility.yml'
- '.github/workflows/desktop_promote_beta.yml'
- '.github/workflows/desktop_rollback_beta.yml'
- '.github/workflows/desktop_breakglass_rollout_beta.yml'
- '.github/workflows/desktop_beta_admission_control.yml'
- '.github/workflows/desktop_promote_prod.yml'
- '.github/workflows/gcp_backend.yml'
- '.github/workflows/gcp_backend_auto_dev.yml'
- '.github/workflows/gcp_cloud_run_metrics_egress.yml'
- '.github/workflows/gcp_firestore_indexes.yml'
- '.github/workflows/gcp_backend*.yml'
- '.github/workflows/gcp_llm_gateway.yml'
- '.github/workflows/gcp_memory_maintenance_job.yml'
- '.github/workflows/gcp_memory_maintenance_job_auto_dev.yml'
- '.github/workflows/gcp_notifications_job.yml'
- '.github/scripts/check_backend_deploy_source_admission.py'
- '.github/scripts/verify_auto_backend_release_admission.py'
- '.github/scripts/verify_backend_release_admission.py'
- '.github/scripts/verify_release_eligibility.py'
- '.github/workflows/sync_ledger_fence_cutover.yml'
- 'scripts/changed-files'
- 'scripts/install-git-hooks.sh'
- 'scripts/pre-push'
- 'scripts/pre-push-singleflight'
- 'scripts/dev-harness/dev_harness/jit_vertex_gateway.py'
- 'scripts/voice-provider-probe.sh'
workflow_dispatch:
permissions:
contents: read
concurrency:
# PR updates supersede earlier test runs; main and manual runs retain an
# independent result for every dispatch.
group: backend-unit-tests-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('run-{0}', github.run_id) }}
cancel-in-progress: true
jobs:
backend-unit-tests:
name: Backend unit suite
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
# Full history is required: the pull_request path resolves the merge base
# live via scripts/changed-files. blob:none keeps the history without
# downloading every historical file blob.
fetch-depth: 0
filter: blob:none
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: backend/.python-version
- name: Set up uv
uses: astral-sh/setup-uv@ecd24dd710f2fb0dca1693a67af11fc4a5c5ec84
with:
enable-cache: true
cache-dependency-glob: backend/pylock*.toml
- name: Set up Helm
uses: azure/setup-helm@v5
- name: Install backend dependencies
working-directory: backend
run: |
uv venv .venv
uv pip sync pylock.toml --python .venv/bin/python
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
- name: Run authoritative backend unit contract
working-directory: backend
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# Resolve the base live against the checkout (matching detect-changes)
# rather than the event-payload base.sha, which can be stale for a
# queued run (FC-stale-event-payload-diff-base, #10785).
../scripts/changed-files "origin/${{ github.base_ref }}"...HEAD > /tmp/backend-changed-files.txt
bash scripts/run-unit-ci.sh --changed-files /tmp/backend-changed-files.txt
else
bash scripts/run-unit-ci.sh --all
fi
# `run-unit-ci.sh` runs `not integration and not slow`, which is correct
# for PR latency but meant every `slow`-marked codebase guardrail in the
# repository executed nowhere. This step runs exactly those, unselected
# and unconditional: a guardrail whose job is to notice a change nobody
# anticipated cannot be gated on the change set that triggered the run.
- name: Run slow-marked backend guardrails
working-directory: backend
run: PYTHON=.venv/bin/python bash scripts/run-slow-guardrails-ci.sh