Skip to content

Commit d7e8b77

Browse files
committed
feat(api): oasdiff OpenAI openAPI spec against ours
diff the `/v1/` routes that are OpenAI compatible against the OpenAI openAPI spec. This will of course only trigger on PRs where the spec is changed. This will catch errors with new handwritten additions to our openAI compat routes. Signed-off-by: Charlie Doern <[email protected]>
1 parent a09e30b commit d7e8b77

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/conformance.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ jobs:
6565
ref: ${{ github.event.pull_request.base.ref }}
6666
path: 'base'
6767

68+
69+
# Cache openai spec
70+
- name: Cache openai openapi spec
71+
id: cache-openapi
72+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809
73+
with:
74+
path: ~/openai-openapi
75+
key: openai-openapi.yml
76+
6877
# Cache oasdiff to avoid checksum failures and speed up builds
6978
- name: Cache oasdiff
7079
if: steps.skip-check.outputs.skip != 'true'
@@ -81,6 +90,12 @@ jobs:
8190
curl -fsSL https://raw.githubusercontent.com/oasdiff/oasdiff/main/install.sh | sh
8291
cp /usr/local/bin/oasdiff ~/oasdiff
8392
93+
- name: Get openai openapi spec
94+
if: steps.cache-openapi.outputs.cache-hit != 'true'
95+
run: |
96+
mkdir -p ~/openai-openapi
97+
curl -L https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml -o ~/openai-openapi/openai-openapi.yml
98+
8499
# Setup cached oasdiff
85100
- name: Setup cached oasdiff
86101
if: steps.skip-check.outputs.skip != 'true' && steps.cache-oasdiff.outputs.cache-hit == 'true'
@@ -137,6 +152,20 @@ jobs:
137152
run: |
138153
oasdiff breaking --fail-on ERR $BASE_SPEC $CURRENT_SPEC --match-path '^/v1/'
139154
155+
# Run oasdiff to detect breaking changes in the API specification when compared to the OpenAI openAPI spec
156+
- name: Run OpenAPI Breaking Change Diff Against OpenAI API
157+
if: steps.skip-check.outputs.skip != 'true'
158+
continue-on-error: true
159+
shell: bash
160+
run: |
161+
OPENAI_SPEC=~/openai-openapi/openai-openapi.yml
162+
LOCAL_SPEC=docs/static/llama-stack-spec.yaml
163+
164+
oasdiff breaking --fail-on ERR \
165+
"$OPENAI_SPEC" \
166+
"$LOCAL_SPEC" \
167+
--match-path "^/v1/.*"
168+
140169
# Report when test is skipped
141170
- name: Report skip reason
142171
if: steps.skip-check.outputs.skip == 'true'

0 commit comments

Comments
 (0)