forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (102 loc) · 4.61 KB
/
Copy pathopenapi-contract.yml
File metadata and controls
119 lines (102 loc) · 4.61 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
name: OpenAPI Contract
on:
push:
branches:
- main
paths:
- 'backend/**'
- 'docs/api-reference/openapi.json'
- 'docs/api-reference/app-client-openapi.json'
- 'docs/api-reference/integration-public-openapi.json'
- 'app/lib/backend/http/api/**'
- 'app/lib/backend/schema/**'
- 'app/lib/backend/schema/gen/**'
- 'app/lib/models/announcement.dart'
- 'app/lib/models/subscription.dart'
- 'app/lib/models/user_usage.dart'
- 'desktop/windows/src/renderer/src/lib/omiApi.generated.ts'
- 'web/app/src/lib/omiApi.generated.ts'
- 'web/admin/lib/services/omi-api/omiApi.generated.ts'
- 'web/personas-open-source/src/lib/omiApi.generated.ts'
- 'docs/docs.json'
- '.github/workflows/openapi-contract.yml'
pull_request:
paths:
- 'backend/**'
- 'docs/api-reference/openapi.json'
- 'docs/api-reference/app-client-openapi.json'
- 'docs/api-reference/integration-public-openapi.json'
- 'app/lib/backend/http/api/**'
- 'app/lib/backend/schema/**'
- 'app/lib/backend/schema/gen/**'
- 'app/lib/models/announcement.dart'
- 'app/lib/models/subscription.dart'
- 'app/lib/models/user_usage.dart'
- 'desktop/windows/src/renderer/src/lib/omiApi.generated.ts'
- 'web/app/src/lib/omiApi.generated.ts'
- 'web/admin/lib/services/omi-api/omiApi.generated.ts'
- 'web/personas-open-source/src/lib/omiApi.generated.ts'
- 'docs/docs.json'
- '.github/workflows/openapi-contract.yml'
workflow_dispatch:
permissions:
contents: read
concurrency:
# Preserve every main/manual compatibility result while cancelling obsolete
# PR revisions that can no longer merge.
group: openapi-contract-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('run-{0}', github.run_id) }}
cancel-in-progress: true
jobs:
openapi-contract:
name: Public Developer API contract
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
- 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:
# Exact version resolves locally; an unset version means "latest",
# which fetches the astral-sh/versions manifest and has hard-failed
# CI on that network call. Matches backend/Dockerfile UV_VERSION.
version: "0.11.13"
enable-cache: true
cache-dependency-glob: backend/openapi-requirements.txt
- name: Fetch released app-client contract baseline
if: github.event_name == 'pull_request'
run: git fetch --no-tags origin "${{ github.base_ref }}"
- name: Reject released app-client breaking changes
if: github.event_name == 'pull_request'
run: python backend/scripts/check_app_client_openapi_compatibility.py --base-ref FETCH_HEAD
- name: Check committed OpenAPI contract
working-directory: backend
run: scripts/openapi_runner.sh scripts/export_openapi.py --check ../docs/api-reference/openapi.json
- name: Check committed app-client OpenAPI contract
working-directory: backend
run: scripts/openapi_runner.sh scripts/export_openapi.py --surface app-client --check ../docs/api-reference/app-client-openapi.json
- name: Check committed integration OpenAPI contract
working-directory: backend
run: scripts/openapi_runner.sh scripts/export_openapi.py --surface integration-public --check ../docs/api-reference/integration-public-openapi.json
- name: Report backend route policy inventory
working-directory: backend
run: scripts/openapi_runner.sh scripts/route_policy_inventory.py --manifest route_policy_manifest.yaml --check --report-only
- name: Enforce backend route policy baseline
run: |
args=()
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
args+=(--base-ref FETCH_HEAD)
fi
python backend/scripts/check_route_policy_baseline.py "${args[@]}"
- name: Check generated app-client Dart schemas
run: python backend/scripts/generate_dart_models.py --all --check
- name: Check generated app-client TypeScript schemas
run: python backend/scripts/generate_ts_openapi_types.py --check
- name: Check generated desktop Swift DTOs
run: python backend/scripts/generate_swift_openapi_types.py --check