Skip to content

Commit d01da7c

Browse files
committed
Try to use the SPM API breaking checker
1 parent acbd697 commit d01da7c

File tree

3 files changed

+24
-94
lines changed

3 files changed

+24
-94
lines changed

Sources/NIOCore/AddressedEnvelope.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ extension AddressedEnvelope: CustomStringConvertible {
5858
}
5959
}
6060

61-
extension AddressedEnvelope: Equatable where DataType: Equatable {}
62-
63-
extension AddressedEnvelope: Hashable where DataType: Hashable {}
61+
//extension AddressedEnvelope: Equatable where DataType: Equatable {}
62+
//
63+
//extension AddressedEnvelope: Hashable where DataType: Hashable {}
6464

6565
/// Possible Explicit Congestion Notification States
6666
public enum NIOExplicitCongestionNotificationState: Hashable {

docker/docker-compose.2004.54.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,37 @@ version: "3"
33
services:
44

55
runtime-setup:
6-
image: swift-nio:20.04-5.4
6+
image: swift-nio:20.04-main
77
build:
88
args:
9+
base_image: "swiftlang/swift:nightly-main-focal"
910
ubuntu_version: "focal"
10-
swift_version: "5.4"
1111

1212
unit-tests:
13-
image: swift-nio:20.04-5.4
13+
image: swift-nio:20.04-main
1414

1515
integration-tests:
16-
image: swift-nio:20.04-5.4
16+
image: swift-nio:20.04-main
1717

1818
test:
19-
image: swift-nio:20.04-5.4
19+
image: swift-nio:20.04-main
2020
environment:
2121
- MAX_ALLOCS_ALLOWED_1000_addHandlers=45050
2222
- MAX_ALLOCS_ALLOWED_1000_addHandlers_sync=38050
2323
- MAX_ALLOCS_ALLOWED_1000_addRemoveHandlers_handlercontext=9050
2424
- MAX_ALLOCS_ALLOWED_1000_addRemoveHandlers_handlername=9050
2525
- MAX_ALLOCS_ALLOWED_1000_addRemoveHandlers_handlertype=9050
26-
- MAX_ALLOCS_ALLOWED_1000_autoReadGetAndSet=25050
26+
- MAX_ALLOCS_ALLOWED_1000_autoReadGetAndSet=24050
2727
- MAX_ALLOCS_ALLOWED_1000_autoReadGetAndSet_sync=0
2828
- MAX_ALLOCS_ALLOWED_1000_getHandlers=9050
29-
- MAX_ALLOCS_ALLOWED_1000_getHandlers_sync=35
3029
- MAX_ALLOCS_ALLOWED_1000_reqs_1_conn=30450
30+
- MAX_ALLOCS_ALLOWED_1000_getHandlers_sync=35
3131
- MAX_ALLOCS_ALLOWED_1000_tcpbootstraps=4050
32-
- MAX_ALLOCS_ALLOWED_1000_tcpconnections=164050
32+
- MAX_ALLOCS_ALLOWED_1000_tcpconnections=160050
3333
- MAX_ALLOCS_ALLOWED_1000_udp_reqs=12050
3434
- MAX_ALLOCS_ALLOWED_1000_udpbootstraps=2050
35-
- MAX_ALLOCS_ALLOWED_1000_udpconnections=90500
36-
- MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=430000
35+
- MAX_ALLOCS_ALLOWED_1000_udpconnections=87050
36+
- MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=427050
3737
- MAX_ALLOCS_ALLOWED_bytebuffer_lots_of_rw=2050
3838
- MAX_ALLOCS_ALLOWED_creating_10000_headers=0
3939
- MAX_ALLOCS_ALLOWED_decode_1000_ws_frames=2050
@@ -42,30 +42,30 @@ services:
4242
- MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_new_buffer=3050
4343
- MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_new_buffer_with_space=3050
4444
- MAX_ALLOCS_ALLOWED_future_erase_result=4050
45-
- MAX_ALLOCS_ALLOWED_future_lots_of_callbacks=60050
45+
- MAX_ALLOCS_ALLOWED_future_lots_of_callbacks=59050
4646
- MAX_ALLOCS_ALLOWED_get_100000_headers_canonical_form=700050
4747
- MAX_ALLOCS_ALLOWED_get_100000_headers_canonical_form_trimming_whitespace=700050
4848
- MAX_ALLOCS_ALLOWED_get_100000_headers_canonical_form_trimming_whitespace_from_long_string=700050
4949
- MAX_ALLOCS_ALLOWED_get_100000_headers_canonical_form_trimming_whitespace_from_short_string=700050
5050
- MAX_ALLOCS_ALLOWED_modifying_1000_circular_buffer_elements=0
5151
- MAX_ALLOCS_ALLOWED_modifying_byte_buffer_view=2050
5252
- MAX_ALLOCS_ALLOWED_ping_pong_1000_reqs_1_conn=4400
53-
- MAX_ALLOCS_ALLOWED_read_10000_chunks_from_file=180050
53+
- MAX_ALLOCS_ALLOWED_read_10000_chunks_from_file=150050
5454
- MAX_ALLOCS_ALLOWED_schedule_10000_tasks=60150
5555
- MAX_ALLOCS_ALLOWED_schedule_and_run_10000_tasks=70050
5656
- MAX_ALLOCS_ALLOWED_scheduling_10000_executions=10150
5757
- MAX_ALLOCS_ALLOWED_udp_1000_reqs_1_conn=12200
58-
- MAX_ALLOCS_ALLOWED_udp_1_reqs_1000_conn=179050
58+
- MAX_ALLOCS_ALLOWED_udp_1_reqs_1000_conn=177050
5959
# - SANITIZER_ARG=--sanitize=thread # TSan broken still
6060

6161
performance-test:
62-
image: swift-nio:20.04-5.4
62+
image: swift-nio:20.04-main
6363

6464
shell:
65-
image: swift-nio:20.04-5.4
65+
image: swift-nio:20.04-main
6666

6767
echo:
68-
image: swift-nio:20.04-5.4
68+
image: swift-nio:20.04-main
6969

7070
http:
71-
image: swift-nio:20.04-5.4
71+
image: swift-nio:20.04-main

scripts/check_no_api_breakages.sh

Lines changed: 4 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,6 @@
1515

1616
set -eu
1717

18-
# repodir
19-
function all_modules() {
20-
local repodir="$1"
21-
(
22-
set -eu
23-
cd "$repodir"
24-
swift package dump-package | jq '.products |
25-
map(select(.type | has("library") )) |
26-
map(.name) | .[]' | tr -d '"'
27-
)
28-
}
29-
30-
# repodir tag output
31-
function build_and_do() {
32-
local repodir=$1
33-
local tag=$2
34-
local output=$3
35-
36-
(
37-
cd "$repodir"
38-
git checkout -q "$tag"
39-
swift build
40-
while read -r module; do
41-
swift api-digester -sdk "$sdk" -dump-sdk -module "$module" \
42-
-o "$output/$module.json" -I "$repodir/.build/debug"
43-
done < <(all_modules "$repodir")
44-
)
45-
}
46-
4718
function usage() {
4819
echo >&2 "Usage: $0 REPO-GITHUB-URL NEW-VERSION OLD-VERSIONS..."
4920
echo >&2
@@ -63,12 +34,6 @@ if [[ $# -lt 3 ]]; then
6334
exit 1
6435
fi
6536

66-
sdk=/
67-
if [[ "$(uname -s)" == Darwin ]]; then
68-
sdk=$(xcrun --show-sdk-path)
69-
fi
70-
71-
hash jq 2> /dev/null || { echo >&2 "ERROR: jq must be installed"; exit 1; }
7237
tmpdir=$(mktemp -d /tmp/.check-api_XXXXXX)
7338
repo_url=$1
7439
new_tag=$2
@@ -77,49 +42,14 @@ shift 2
7742
repodir="$tmpdir/repo"
7843
git clone "$repo_url" "$repodir"
7944
git -C "$repodir" fetch -q origin '+refs/pull/*:refs/remotes/origin/pr/*'
80-
errors=0
45+
cd "$repodir"
46+
git checkout -q "$new_tag"
8147

8248
for old_tag in "$@"; do
83-
mkdir "$tmpdir/api-old"
84-
mkdir "$tmpdir/api-new"
85-
8649
echo "Checking public API breakages from $old_tag to $new_tag"
8750

88-
build_and_do "$repodir" "$new_tag" "$tmpdir/api-new/"
89-
build_and_do "$repodir" "$old_tag" "$tmpdir/api-old/"
90-
91-
for f in "$tmpdir/api-new"/*; do
92-
f=$(basename "$f")
93-
report="$tmpdir/$f.report"
94-
if [[ ! -f "$tmpdir/api-old/$f" ]]; then
95-
echo "NOTICE: NEW MODULE $f"
96-
continue
97-
fi
98-
99-
echo -n "Checking $f... "
100-
swift api-digester -sdk "$sdk" -diagnose-sdk \
101-
--input-paths "$tmpdir/api-old/$f" -input-paths "$tmpdir/api-new/$f" 2>&1 \
102-
> "$report" 2>&1
103-
104-
# the shasum here is for an empty report, i.e. no changes
105-
# if the shasum of the new report is different, then there's
106-
# obviously an API change
107-
if ! shasum "$report" | grep -q afd2a1b542b33273920d65821deddc653063c700; then
108-
echo ERROR
109-
echo >&2 "=============================="
110-
echo >&2 "ERROR: public API change in $f"
111-
echo >&2 "=============================="
112-
cat >&2 "$report"
113-
errors=$(( errors + 1 ))
114-
else
115-
echo OK
116-
fi
117-
done
118-
rm -rf "$tmpdir/api-new" "$tmpdir/api-old"
51+
swift package diagnose-api-breaking-changes "$old_tag"
11952
done
12053

121-
if [[ "$errors" == 0 ]]; then
122-
echo "OK, all seems good"
123-
fi
12454
echo done
125-
exit "$errors"
55+
exit 0

0 commit comments

Comments
 (0)