Skip to content

Commit 0c55132

Browse files
authored
Pin the SwiftFormat version in CI (#934)
Motivation: Recent versions of SwiftFormat seem to have issues when loading configuration files. This causes the lint check to unexpectedlty fail in CI. Modifications: - Pin the SwiftFormat version in CI - Ensure the exit code from the sanity script is bubbled up to the travis script Result: Formatting works in CI
1 parent 723dcc0 commit 0c55132

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.travis-install.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ PROTOBUF_VERSION=3.9.1
3737
# We need this to build gRPC C++ for the interop test server(s).
3838
BAZEL_VERSION=0.28.1
3939
GRPC_VERSION=1.23.0
40+
SWIFTFORMAT_VERSION=0.44.13
4041

4142
info() {
4243
printf '\033[0;34m%s\033[0m\n' "$1"
@@ -182,21 +183,20 @@ function install_swiftformat() {
182183
echo -en 'travis_fold:start:install.swiftformat\\r'
183184
info "Installing swiftformat"
184185

185-
186-
if [ ! -f "$BIN_CACHE/swiftformat" ]; then
187-
git clone --depth 1 "https://github.com/nicklockwood/SwiftFormat"
186+
if [ ! -f "$BIN_CACHE/swiftformat-$SWIFTFORMAT_VERSION" ]; then
187+
git clone -b "$SWIFTFORMAT_VERSION" --depth 1 "https://github.com/nicklockwood/SwiftFormat"
188188

189189
info "Building swiftformat"
190190
cd SwiftFormat
191191
swift build --product swiftformat
192192

193-
cp "$(swift build --show-bin-path)/swiftformat" "$BIN_CACHE/swiftformat"
193+
cp "$(swift build --show-bin-path)/swiftformat" "$BIN_CACHE/swiftformat-$SWIFTFORMAT_VERSION"
194194
else
195195
info "Skipping download and build of SwiftFormat, using cached binaries"
196196
fi
197197

198198
# We should have cached swiftformat now, copy it to $HOME/local/bin
199-
cp "$BIN_CACHE/swiftformat" "$HOME"/local/bin/swiftformat
199+
cp "$BIN_CACHE/swiftformat-$SWIFTFORMAT_VERSION" "$HOME"/local/bin/swiftformat
200200

201201
success "Installed swiftformat"
202202
echo -en 'travis_fold:end:install.swiftformat\\r'

scripts/sanity.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function run_logged() {
2929
if $command > "$log" 2>&1; then
3030
printf "\033[0;32mOK\033[0m\n"
3131
else
32+
errors=$(( errors + 1))
3233
printf "\033[0;31mFAILED\033[0m\n"
3334
echo "=== Captured output:"
3435
cat "$log"
@@ -45,5 +46,7 @@ function check_formatting() {
4546
run_logged "Checking formatting" "swiftformat --lint $HERE/.."
4647
}
4748

49+
errors=0
4850
check_license_headers
4951
check_formatting
52+
exit $errors

0 commit comments

Comments
 (0)