Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 11852a8

Browse files
authored
Suppress "Swift_Transport" BC errors (#652)
1 parent 204a32e commit 11852a8

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.github/workflows/bc.entrypoint

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh -l
2+
3+
#
4+
# This file is a hack to suppress warnings from Roave BC check
5+
#
6+
7+
composer install
8+
9+
# Capture output to variable AND print it
10+
exec 4711>&1
11+
OUTPUT=$(/composer/vendor/bin/roave-backward-compatibility-check 2>&1 | tee /dev/fd/4711)
12+
13+
# Remove rows we want to suppress
14+
OUTPUT=`echo "$OUTPUT" | sed '/Roave\\\BetterReflection\\\Reflection\\\ReflectionClass "Swift_Transport" could not be found in the located source/'d`
15+
16+
# Number of rows we found with "[BC]" in them
17+
BC_BREAKS=`echo "$OUTPUT" | grep -o '\[BC\]' | wc -l | awk '{ print $1 }'`
18+
19+
# The last row of the output is "X backwards-incompatible changes detected". Find X.
20+
STATED_BREAKS=`echo "$OUTPUT" | tail -n 1 | awk -F' ' '{ print $1 }'`
21+
22+
# If
23+
# We found "[BC]" in the command output after we removed suppressed lines
24+
# OR
25+
# We have suppressed X number of BC breaks. If $STATED_BREAKS is larger than X
26+
# THEN
27+
# exit 1
28+
29+
if [ $BC_BREAKS -gt 0 ] || [ $STATED_BREAKS -gt 6 ]; then
30+
echo "EXIT 1"
31+
exit 1
32+
fi
33+
34+
# No BC breaks found
35+
echo "EXIT 0"
36+
exit 0

.github/workflows/checks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ jobs:
2525
2626
- name: Roave BC Check
2727
uses: docker://nyholm/roave-bc-check-ga
28+
with:
29+
entrypoint: ./.github/workflows/bc.entrypoint

0 commit comments

Comments
 (0)