Skip to content

Commit

Permalink
added configurations for travis CI, swift lint and code cov
Browse files Browse the repository at this point in the history
  • Loading branch information
alemar11 committed Oct 17, 2017
1 parent 43b3812 commit f092e62
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .swiftlint.yml
@@ -0,0 +1,44 @@
included:
- Sources

excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- Tests
- Support
- docs
- build

disabled_rules: # rule identifiers to exclude from running
- large_tuple
- todo

line_length:
- 200 #warning
- 250 #error

type_body_length:
- 700 #warning
- 1000 #error

file_length:
- 1000 #warning
- 1200 #error

function_body_length:
- 125 #warning
- 200 #error

type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 50
error: 50

type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 50
error: 50

reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)
69 changes: 69 additions & 0 deletions .travis.yml
@@ -0,0 +1,69 @@
language: objective-c
osx_image: xcode9.1
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
- IOS_FRAMEWORK_SCHEME="CoreDataPlus iOS"
- MACOS_FRAMEWORK_SCHEME="CoreDataPlus macOS"
- TVOS_FRAMEWORK_SCHEME="CoreDataPlus tvOS"
- WATCHOS_FRAMEWORK_SCHEME="CoreDataPlus watchOS"
- IOS_SDK=iphonesimulator11.1
- MACOS_SDK=macosx10.13
- TVOS_SDK=appletvsimulator11.1
- WATCHOS_SDK=watchsimulator4.1
#- WORKSPACE=CoreDataPlus.xcworkspace
#- EXAMPLE_SCHEME="CoreDataPlus Example"

matrix:
- DESTINATION="OS=10.3.1,name=iPhone 5" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" POD_LINT="YES" CODECOV_FLAG="ios10-32bit"
- DESTINATION="OS=10.3.1,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" POD_LINT="NO" CODECOV_FLAG="ios10"
- DESTINATION="OS=3.2,name=Apple Watch - 42mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK" RUN_TESTS="NO" POD_LINT="NO" CODECOV_FLAG="watchos3"
- DESTINATION="OS=10.2,name=Apple TV 1080p" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK" RUN_TESTS="YES" POD_LINT="NO" CODECOV_FLAG="tvos10"
- DESTINATION="arch=x86_64" SCHEME="$MACOS_FRAMEWORK_SCHEME" SDK="$MACOS_SDK" RUN_TESTS="YES" POD_LINT="NO" CODECOV_FLAG="macos10_12"

- DESTINATION="OS=11.1,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" POD_LINT="YES" CODECOV_FLAG="ios"
- DESTINATION="OS=4.1,name=Apple Watch - 42mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK" RUN_TESTS="NO" POD_LINT="NO" CODECOV_FLAG="watchos"
- DESTINATION="OS=11.1,name=Apple TV 4K (at 1080p)" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK" RUN_TESTS="YES" POD_LINT="NO" CODECOV_FLAG="tvos"
- DESTINATION="arch=x86_64" SCHEME="$MACOS_FRAMEWORK_SCHEME" SDK="$MACOS_SDK" RUN_TESTS="YES" POD_LINT="NO" CODECOV_FLAG="macos"

# skip release group defined in Gemfile
bundler_args: --without release

before_install:
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- brew install swiftlint
# fix for watchOS until https://github.com/travis-ci/travis-ci/issues/7580 is fixed
# - xcrun simctl delete 38C891AB-EC79-43E4-9311-6FDEB12DCF11 || true

before_script:
- swiftlint --reporter "emoji"

script:
- set -o pipefail
- xcodebuild -version
- xcodebuild -showsdks
- swift --version

# Build Framework in Debug and Run Tests if specified
- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=YES ENABLE_TESTABILITY=YES build-for-testing test-without-building | xcpretty;
bash <(curl -s https://codecov.io/bash) -J 'CoreDataPlus' -cF "$CODECOV_FLAG"
else
xcodebuild -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty;
fi

# Build Framework in Release and Run Tests if specified
- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES build-for-testing test-without-building | xcpretty;
else
xcodebuild -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty;
fi

# Run `pod lib lint` if specified
- if [ $POD_LINT == "YES" ]; then
pod lib lint;
fi

after_success:
- sleep 5
4 changes: 4 additions & 0 deletions codecov.yml
@@ -0,0 +1,4 @@
coverage:
ignore:
- Examples/*
- Tests/*

0 comments on commit f092e62

Please sign in to comment.