-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to check for API breaks (#258)
Co-authored-by: tomer doron <tomer@apple.com>
- Loading branch information
1 parent
e5b4496
commit f6c7c5a
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the SwiftAWSLambdaRuntime open source project | ||
## | ||
## Copyright (c) 2022 Apple Inc. and the SwiftAWSLambdaRuntime project authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See CONTRIBUTORS.txt for the list of SwiftAWSLambdaRuntime project authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the SwiftNIO open source project | ||
## | ||
## Copyright (c) 2017-2020 Apple Inc. and the SwiftNIO project authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
set -eu | ||
|
||
function usage() { | ||
echo >&2 "Usage: $0 REPO-GITHUB-URL NEW-VERSION OLD-VERSIONS..." | ||
echo >&2 | ||
echo >&2 "This script requires a Swift 5.6+ toolchain." | ||
echo >&2 | ||
echo >&2 "Examples:" | ||
echo >&2 | ||
echo >&2 "Check between main and tag 2.1.1 of swift-nio:" | ||
echo >&2 " $0 https://github.com/apple/swift-nio main 2.1.1" | ||
echo >&2 | ||
echo >&2 "Check between HEAD and commit 64cf63d7 using the provided toolchain:" | ||
echo >&2 " xcrun --toolchain org.swift.5120190702a $0 ../some-local-repo HEAD 64cf63d7" | ||
} | ||
|
||
if [[ $# -lt 3 ]]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
tmpdir=$(mktemp -d /tmp/.check-api_XXXXXX) | ||
repo_url=$1 | ||
new_tag=$2 | ||
shift 2 | ||
|
||
repodir="$tmpdir/repo" | ||
git clone "$repo_url" "$repodir" | ||
git -C "$repodir" fetch -q origin '+refs/pull/*:refs/remotes/origin/pr/*' | ||
cd "$repodir" | ||
git checkout -q "$new_tag" | ||
|
||
for old_tag in "$@"; do | ||
echo "Checking public API breakages from $old_tag to $new_tag" | ||
|
||
swift package diagnose-api-breaking-changes "$old_tag" | ||
done | ||
|
||
echo done |