Skip to content

Commit 1f93055

Browse files
chore(internal): add breaking change detection
1 parent 96581bc commit 1f93055

3 files changed

Lines changed: 55 additions & 1 deletion

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- next
7+
8+
jobs:
9+
detect_breaking_changes:
10+
runs-on: 'ubuntu-latest'
11+
name: detect-breaking-changes
12+
if: github.repository == 'cloudflare/cloudflare-python'
13+
steps:
14+
- name: Calculate fetch-depth
15+
run: |
16+
echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV
17+
18+
- uses: actions/checkout@v4
19+
with:
20+
# Ensure we can check out the pull request base in the script below.
21+
fetch-depth: ${{ env.FETCH_DEPTH }}
22+
23+
- name: Install Rye
24+
run: |
25+
curl -sSf https://rye.astral.sh/get | bash
26+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
27+
env:
28+
RYE_VERSION: '0.44.0'
29+
RYE_INSTALL_OPTION: '--yes'
30+
- name: Install dependencies
31+
run: |
32+
rye sync --all-features
33+
34+
- name: Detect breaking changes
35+
run: ./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1769
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-96ad9bfaad2a1dce9c6cccc0b105a257651c44566e5038a75fbf769f2ffacd9b.yml
33
openapi_spec_hash: 241cae658fd35c1eca02921272879760
4-
config_hash: 553b8c9fbe8068eae649aed371f36d6f
4+
config_hash: 18e6b76de8b719dd7c9c28614ac32643

scripts/detect-breaking-changes

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
cd "$(dirname "$0")/.."
6+
7+
echo "==> Detecting breaking changes"
8+
9+
TEST_PATHS=( tests/api_resources tests/test_client.py tests/test_response.py )
10+
11+
for PATHSPEC in "${TEST_PATHS[@]}"; do
12+
# Try to check out previous versions of the test files
13+
# with the current SDK.
14+
git checkout "$1" -- "${PATHSPEC}" 2>/dev/null || true
15+
done
16+
17+
# Instead of running the tests, use the linter to check if an
18+
# older test is no longer compatible with the latest SDK.
19+
./scripts/lint

0 commit comments

Comments
 (0)