Skip to content

Commit

Permalink
support detecting Travis CI in iOS Simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
cezheng committed Oct 10, 2015
1 parent 08d4106 commit 3d041e4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ language: objective-c
os: osx
osx_image: xcode7
xcode_workspace: Volkswagen.xcworkspace
xcode_scheme: VolksWagen-iOS
xcode_scheme: Volkswagen-iOS

script: xcodebuild -workspace VolksWagen.xcworkspace -scheme Volkswagen-OSX -sdk macosx test
script: xcodebuild -workspace Volkswagen.xcworkspace -scheme Volkswagen-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' test
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Volkswagen for Xcode
[![Build Status](https://travis-ci.org/cezheng/Volkswagen-Xcode.svg)](https://travis-ci.org/cezheng/Volkswagen-Xcode)
Volkswagen for Xcode makes failing test cases pass in CI servers.

This project is inspired by [volkswagen
Expand Down Expand Up @@ -53,7 +54,7 @@ Pure Objective-C projects using Cocoapods should have lower requirements since t
### Manually include the source
- I have tested this yet, but this should work with almost all versions of OS in recent years
> Currently using `Volkswagen-Xcode` on iOS has some problems detecting the enviroment variables from the outside shell. I'm working to resolve this problem.
> Currently using `Volkswagen-Xcode` on iOS only supports Travis CI. More CI environment detection is yet to come. Keep an eye on this [issue](https://github.com/cezheng/Volkswagen-Xcode/issues/1).
#Installation
##CocoaPods
Expand Down
14 changes: 12 additions & 2 deletions Volkswagen/NSException+Volkswagen.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
@interface NSException (Volkswagen)
@end

#if TARGET_IPHONE_SIMULATOR
static BOOL is_in_ci() {
NSString *tmpDir = @(getenv("TMPDIR"));
// Travis CI
if ([tmpDir hasPrefix:@"/Users/travis"]) {
return true;
}
return false;
}
#else
static BOOL is_in_ci() {
return getenv("CI")
|| getenv("CONTINUOUS_INTEGRATION")
Expand All @@ -40,9 +50,10 @@ static BOOL is_in_ci() {
|| getenv("GOCD_SERVER_HOST")
|| getenv("BUILDKITE");
}
#endif

static void do_nothing() {

}

@implementation NSException (Volkswagen)
Expand All @@ -67,4 +78,3 @@ + (void)load {
}

@end

0 comments on commit 3d041e4

Please sign in to comment.