Skip to content

Commit c118e39

Browse files
committed
Add SwiftPM diagnose-api-breaking-changes check.
Just run this on each PR to flag any changes. Since `main` is working toward a 2.0 release, we should be ok making breaking changes, but it likely doesn't hurt to realize what the breaks are. Used some of the https://github.com/vapor projects for reference and the git magic needed to for the action to run. Fixes #1026
1 parent fadaf7d commit c118e39

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,32 @@ jobs:
106106
working-directory: main
107107
run: make compile-tests PROTOC=../protobuf/cmake_build/protoc
108108

109+
api-breakage:
110+
# Only on pull requests
111+
if: github.event_name == 'pull_request'
112+
runs-on: ubuntu-latest
113+
# Since `main` is currently accepting breaking changes, don't fail the whole
114+
# PR if this one check fails.
115+
continue-on-error: true
116+
container:
117+
# Test on the latest Swift release. This could run on all the support
118+
# Swift versions, but that doesn't seem worth it until there are Swift
119+
# version specific conditionals to justify it.
120+
image: swift:latest
121+
steps:
122+
- name: Checkout
123+
uses: actions/checkout@v4
124+
with:
125+
fetch-depth: 0
126+
- name: Mark the workspace as safe
127+
# https://github.com/actions/checkout/issues/766
128+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
129+
- name: Check for API breaking changes
130+
# This will catch changes compared to main, so it doesn't build up a list.
131+
# Once main is used for releases, we might want to change this to diff
132+
# against the last release.
133+
run: swift package diagnose-api-breaking-changes origin/main --products SwiftProtobuf
134+
109135
sanitizer_testing:
110136
runs-on: ubuntu-latest
111137
strategy:

0 commit comments

Comments
 (0)