chore(internal): add tests for breaking change detection

This commit is contained in:
stainless-app[bot]
2025-06-24 20:27:51 +00:00
parent c1436dec13
commit 0db112f3bc
3 changed files with 85 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
name: CI
on:
pull_request:
branches:
- main
- next
jobs:
detect_breaking_changes:
runs-on: 'ubuntu-latest'
name: detect-breaking-changes
if: github.repository == 'openai/openai-go'
steps:
- name: Calculate fetch-depth
run: |
echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
# Ensure we can check out the pull request base in the script below.
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- name: Detect breaking changes
run: ./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }}

View File

@@ -1,4 +1,4 @@
configured_endpoints: 97
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ef4ecb19eb61e24c49d77fef769ee243e5279bc0bdbaee8d0f8dba4da8722559.yml
openapi_spec_hash: 1b8a9767c9f04e6865b06c41948cdc24
config_hash: fd2af1d5eff0995bb7dc02ac9a34851d
config_hash: cae2d1f187b5b9f8dfa00daa807da42a

55
scripts/detect-breaking-changes Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")/.."
echo "==> Detecting breaking changes"
TEST_PATHS=(
client_test.go
completion_test.go
chatcompletion_test.go
chatcompletionmessage_test.go
embedding_test.go
file_test.go
image_test.go
audiotranscription_test.go
audiotranslation_test.go
audiospeech_test.go
moderation_test.go
model_test.go
finetuningjob_test.go
finetuningjobcheckpoint_test.go
finetuningcheckpointpermission_test.go
finetuningalphagrader_test.go
vectorstore_test.go
vectorstorefile_test.go
vectorstorefilebatch_test.go
betaassistant_test.go
betathread_test.go
betathreadrun_test.go
betathreadrunstep_test.go
betathreadmessage_test.go
batch_test.go
upload_test.go
uploadpart_test.go
responses/response_test.go
responses/inputitem_test.go
container_test.go
containerfile_test.go
containerfilecontent_test.go
usage_test.go
paginationauto_test.go
paginationmanual_test.go
)
for PATHSPEC in "${TEST_PATHS[@]}"; do
# Try to check out previous versions of the test files
# with the current SDK.
git checkout "$1" -- "${PATHSPEC}" 2>/dev/null || true
done
# Instead of running the tests, use the linter to check if an
# older test is no longer compatible with the latest SDK.
./scripts/lint