* optimize travis build

This commit is contained in:
Felix Mau
2018-01-20 12:57:19 +01:00
parent 62d9da622b
commit 7ce71ffa5e
7 changed files with 49 additions and 20 deletions
+13 -9
View File
@@ -1,14 +1,18 @@
# references:
# * http://www.objc.io/issue-6/travis-ci.html
# * https://github.com/supermarin/xcpretty#usage
#
# travis.yml
# Created by Felix Mau (http://felix.hamburg)
#
# Based on:
# - http://www.mokacoding.com/blog/travis-ci-ios-testing/
#
osx_image: xcode9
osx_image: xcode9.2
language: objective-c
cache: cocoapods
podfile: Example/Podfile
before_install:
- gem install cocoapods # Since Travis is not always on latest version
- pod install --repo-update --project-directory=Example # "--repo-update" Fixes pod out of sync
- brew install swiftlint
- pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/GradientLoadingBar.xcworkspace -scheme GradientLoadingBar-Example -destination "platform=iOS Simulator,name=iPhone 7,OS=11.0" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
- ./Scripts/swift-lint.sh
- ./Scripts/test.sh
- ./Scripts/pod-lint.sh
@@ -433,7 +433,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ -f \"${PODS_ROOT}/SwiftLint/swiftlint\" ]; then\n ${PODS_ROOT}/SwiftLint/swiftlint\nelse\n echo \"warning: SwiftLint not installed!\"\nfi";
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
};
97C4F18C1F7F8E7E00739B14 /* Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
@@ -447,7 +447,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ -f \"${PODS_ROOT}/SwiftLint/swiftlint\" ]; then\n ${PODS_ROOT}/SwiftLint/swiftlint\nelse\n echo \"warning: SwiftLint not installed!\"\nfi";
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
};
E3CF36B5598601D100CC228C /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
-3
View File
@@ -5,9 +5,6 @@ use_frameworks!
target 'GradientLoadingBar_Example' do
pod 'GradientLoadingBar', :path => '../'
# Dev Dependecies
pod 'SwiftLint'
target 'GradientLoadingBar_Tests' do
inherit! :search_paths
+3 -6
View File
@@ -1,19 +1,16 @@
PODS:
- GradientLoadingBar (1.1.3)
- SwiftLint (0.22.0)
- GradientLoadingBar (1.1.7)
DEPENDENCIES:
- GradientLoadingBar (from `../`)
- SwiftLint
EXTERNAL SOURCES:
GradientLoadingBar:
:path: ../
SPEC CHECKSUMS:
GradientLoadingBar: 6ab1e4025fdcbdc2a8c85e0a62663c23ab7233d0
SwiftLint: 1134786caedd2caab0560d2f36b76414a5a56808
GradientLoadingBar: 72dde6b54d857eaae7c6ef8dd1f7a6d79a9f4156
PODFILE CHECKSUM: e0d0b1a0e282841ea073c71d203e50b0435aa820
PODFILE CHECKSUM: 1d80983f514bad6faf2cba60763ce0f60c671f8e
COCOAPODS: 1.3.1
+6
View File
@@ -0,0 +1,6 @@
#
# pod-lint.sh
# Created by Felix Mau (http://felix.hamburg)
#
pod lib lint
+7
View File
@@ -0,0 +1,7 @@
#
# swift-lint.sh
# Created by Felix Mau (http://felix.hamburg)
#
# Run "swiftlint" and break build on any warnings
cd Example && swiftlint --strict
+18
View File
@@ -0,0 +1,18 @@
#
# test.sh
# Created by Felix Mau (http://felix.hamburg)
#
# Based on:
# - http://www.mokacoding.com/blog/running-tests-from-the-terminal/
# - https://github.com/supermarin/xcpretty#usage
# - https://www.objc.io/issues/6-build-tools/travis-ci/
#
xcodebuild \
-workspace Example/GradientLoadingBar.xcworkspace \
-scheme GradientLoadingBar-Example \
-enableCodeCoverage YES \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone X,OS=11.2' \
ONLY_ACTIVE_ARCH=NO \
test | xcpretty && exit ${PIPESTATUS[0]}