Commit 12e4668
authored
Add check-for-breaking-api-changes.sh script (#21)
### Motivation
We want to know when we are making breaking changes to our public API.
### Modifications
Add a script that wraps `swift package diagnose-api-breaking-changes`
which we'll start to use in CI.
### Result
A script can be used to validate the current repo state against a
baseline repo and treeish for breaking API changes.
### Notes
Running this script produces the following output:
```console
❯ BASELINE_REPO_URL=https://github.com/apple/swift-openapi-runtime BASELINE_TREEISH=main bash scripts/check-for-breaking-api-changes.sh
** Checking required environment variables...
** Fetching baseline: https://github.com/apple/swift-openapi-runtime#main...
From https://github.com/apple/swift-openapi-runtime
* branch main -> FETCH_HEAD
** Checking for API changes since https://github.com/apple/swift-openapi-runtime#main (e81f70f)...
Building for debugging...
Build complete! (7.53s)
No breaking changes detected in OpenAPIRuntime
** ✅ No breaking API changes detected.
```
Then making the following local change...
```diff
diff --git a/Sources/OpenAPIRuntime/Conversion/Converter.swift b/Sources/OpenAPIRuntime/Conversion/Converter.swift
index 2aac666..f2abb63 100644
--- a/Sources/OpenAPIRuntime/Conversion/Converter.swift
+++ b/Sources/OpenAPIRuntime/Conversion/Converter.swift
@@ -35,7 +35,8 @@ public struct Converter: Sendable {
/// Creates a new converter with the behavior specified by the configuration.
public init(
- configuration: Configuration
+ configuration: Configuration,
+ i: Int = 1
) {
self.configuration = configuration
```
...and rerunning the script, gives the following output...
```
...
1 breaking change detected in OpenAPIRuntime:
💔 API breakage: constructor Converter.init(configuration:) has been removed
** ERROR: ❌ Breaking API changes detected.
```
---------
Signed-off-by: Si Beaumont <beaumont@apple.com>1 parent e81f70f commit 12e4668
1 file changed
+42
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments