From 0e4804c81dbce7811dad08b09cf5449eb06c603d Mon Sep 17 00:00:00 2001 From: Abhishek Banthia Date: Sun, 5 May 2019 16:34:18 -0700 Subject: [PATCH] Adding swiftlint yo. --- .travis.yml | 3 +++ swiftlint-install.sh | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 swiftlint-install.sh diff --git a/.travis.yml b/.travis.yml index a8686bb..c2e3dc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,10 @@ before_install: - export TZ=America/Los_Angeles before_script: - xcodebuild -version +install: + - ./swiftlint-install.sh script: - set -o pipefail && env "NSUnbufferedIO=YES" + - swiftlint - xcodebuild -project Clocker/Clocker.xcodeproj -scheme Clocker build analyze CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY= | xcpretty - xcodebuild -project Clocker/Clocker.xcodeproj -scheme Clocker test CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY= | xcpretty \ No newline at end of file diff --git a/swiftlint-install.sh b/swiftlint-install.sh new file mode 100755 index 0000000..fc8bd11 --- /dev/null +++ b/swiftlint-install.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Installs the SwiftLint package. +# Tries to get the precompiled .pkg file from Github, but if that +# fails just recompiles from source. + +set -e + +SWIFTLINT_PKG_PATH="/tmp/SwiftLint.pkg" +SWIFTLINT_PKG_URL="https://github.com/realm/SwiftLint/releases/download/0.9.1/SwiftLint.pkg" + +wget --output-document=$SWIFTLINT_PKG_PATH $SWIFTLINT_PKG_URL + +if [ -f $SWIFTLINT_PKG_PATH ]; then + echo "SwiftLint package exists! Installing it..." + sudo installer -pkg $SWIFTLINT_PKG_PATH -target / +else + echo "SwiftLint package doesn't exist. Compiling from source..." && + git clone https://github.com/realm/SwiftLint.git /tmp/SwiftLint && + cd /tmp/SwiftLint && + git submodule update --init --recursive && + sudo make install +fi \ No newline at end of file