diff --git a/.travis.yml b/.travis.yml index 115ee5a..a10ee69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 \ No newline at end of file diff --git a/Example/GradientLoadingBar.xcodeproj/project.pbxproj b/Example/GradientLoadingBar.xcodeproj/project.pbxproj index 903ced8..22516df 100644 --- a/Example/GradientLoadingBar.xcodeproj/project.pbxproj +++ b/Example/GradientLoadingBar.xcodeproj/project.pbxproj @@ -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; diff --git a/Example/Podfile b/Example/Podfile index 3e09ce1..81bb6a4 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -5,9 +5,6 @@ use_frameworks! target 'GradientLoadingBar_Example' do pod 'GradientLoadingBar', :path => '../' - # Dev Dependecies - pod 'SwiftLint' - target 'GradientLoadingBar_Tests' do inherit! :search_paths diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 32426db..6f8e123 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -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 diff --git a/Scripts/pod-lint.sh b/Scripts/pod-lint.sh new file mode 100755 index 0000000..d0b3408 --- /dev/null +++ b/Scripts/pod-lint.sh @@ -0,0 +1,6 @@ +# +# pod-lint.sh +# Created by Felix Mau (http://felix.hamburg) +# + +pod lib lint diff --git a/Scripts/swift-lint.sh b/Scripts/swift-lint.sh new file mode 100755 index 0000000..0bf57a6 --- /dev/null +++ b/Scripts/swift-lint.sh @@ -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 diff --git a/Scripts/test.sh b/Scripts/test.sh new file mode 100755 index 0000000..3c8f6a1 --- /dev/null +++ b/Scripts/test.sh @@ -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]} \ No newline at end of file