Skip to content

Commit 2d4d59f

Browse files
author
Chris Pilcher
committed
Configure Travis CI to run SwiftLint
1 parent feeccfb commit 2d4d59f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
language: objective-c
22
osx_image: xcode7.3
33

4+
install:
5+
6+
- ./install_swiftlint.sh
7+
48
script:
59

10+
- swiftlint
11+
612
- xcodebuild test -project ./All-Pairs\ Shortest\ Paths/APSP/APSP.xcodeproj -scheme APSPTests
713
- xcodebuild test -project ./Array2D/Tests/Tests.xcodeproj -scheme Tests
814
- xcodebuild test -project ./AVL\ Tree/Tests/Tests.xcodeproj -scheme Tests

install_swiftlint.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Installs the SwiftLint package.
4+
# Tries to get the precompiled .pkg file from Github, but if that
5+
# fails just recompiles from source.
6+
7+
set -e
8+
9+
SWIFTLINT_PKG_PATH="/tmp/SwiftLint.pkg"
10+
SWIFTLINT_PKG_URL="https://github.com/realm/SwiftLint/releases/download/0.10.0/SwiftLint.pkg"
11+
12+
wget --output-document=$SWIFTLINT_PKG_PATH $SWIFTLINT_PKG_URL
13+
14+
if [ -f $SWIFTLINT_PKG_PATH ]; then
15+
echo "SwiftLint package exists! Installing it..."
16+
sudo installer -pkg $SWIFTLINT_PKG_PATH -target /
17+
else
18+
echo "SwiftLint package doesn't exist. Compiling from source..." &&
19+
git clone https://github.com/realm/SwiftLint.git /tmp/SwiftLint &&
20+
cd /tmp/SwiftLint &&
21+
git submodule update --init --recursive &&
22+
sudo make install
23+
fi

0 commit comments

Comments
 (0)