Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Multiple Platform CI #242

Merged
merged 13 commits into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 116 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
version: 2
jobs:
build-and-test:
build-and-test-iOS-swift-4.2:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rename it to something shorter. They are all builds running tests.

  • iOS-swift-4.2-build
  • build-iOS-swift-4.2

Copy link
Member Author

@cocojoe cocojoe Nov 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will think about it 😉

macos:
xcode: "10.0.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
BUNDLE_PATH: ~/.gems

steps:
- checkout
- run: |
- run: |
brew install swiftlint
bundle install --without=developments
bundle install --without=development
grep -lR "shouldUseLaunchSchemeArgsEnv" *.* --null | xargs -0 sed -i '' -e 's/shouldUseLaunchSchemeArgsEnv = "YES"/shouldUseLaunchSchemeArgsEnv = "YES" codeCoverageEnabled = "YES"/g'
- run:
name: Bootstrap
Expand All @@ -24,20 +22,127 @@ jobs:
SCHEME: Auth0.iOS
DEVICE: iPhone 8
FASTLANE_EXPLICIT_OPEN_SIMULATOR: 2
- run:
name: Pod Lib Lint
command: bundle exec fastlane ios pod_lint
- run: |
bash <(curl -s https://codecov.io/bash) -J 'Auth0'
bash <(curl -s https://codecov.io/bash) -J 'Auth0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also upload the coverage for the rest of the build variants? Why do you need to pass the package name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've ran into issues in the past with multiple codecov, I don't think it understands what to do with it for example. MacOS doesn't have WebAuth so if that report is sent after the iOS one codecov will report lots of missing codecov.

- save_cache:
key: dependency-cache
paths:
- Carthage/Build
- store_test_results:
path: fastlane/test_output
build-and-test-iOS-swift-4.0:
macos:
xcode: "10.0.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
steps:
- checkout
- run: |
brew install swiftlint
bundle install --without=development
grep -lR "shouldUseLaunchSchemeArgsEnv" *.* --null | xargs -0 sed -i '' -e 's/shouldUseLaunchSchemeArgsEnv = "YES"/shouldUseLaunchSchemeArgsEnv = "YES" codeCoverageEnabled = "YES"/g'
sed -i "" 's/SWIFT_VERSION = 4.2/SWIFT_VERSION = 4.0/g' "Auth0.xcodeproj/project.pbxproj"
- run:
name: Bootstrap
command: bundle exec fastlane ios bootstrap
- run:
name: Run test suite
command: bundle exec fastlane ios ci
environment:
SCHEME: Auth0.iOS
DEVICE: iPhone 8
FASTLANE_EXPLICIT_OPEN_SIMULATOR: 2
- save_cache:
key: dependency-cache
paths:
- Carthage/Build
build-and-test-iOS-swift-3.0:
macos:
xcode: "9.4.1"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
steps:
- checkout
- run: |
brew install swiftlint
sudo gem install bundler
bundle install --without=development
grep -lR "shouldUseLaunchSchemeArgsEnv" *.* --null | xargs -0 sed -i '' -e 's/shouldUseLaunchSchemeArgsEnv = "YES"/shouldUseLaunchSchemeArgsEnv = "YES" codeCoverageEnabled = "YES"/g'
sed -i "" 's/SWIFT_VERSION = 4.2/SWIFT_VERSION = 3.3/g' "Auth0.xcodeproj/project.pbxproj"
- run:
name: Bootstrap
command: bundle exec fastlane ios bootstrap
- run:
name: Run test suite
command: bundle exec fastlane ios ci
environment:
SCHEME: Auth0.iOS
DEVICE: iPhone 8
FASTLANE_EXPLICIT_OPEN_SIMULATOR: 2
- save_cache:
key: dependency-cache
paths:
- Carthage/Build
build-and-test-macOS-swift-4.2:
macos:
xcode: "10.0.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
steps:
- checkout
- run: |
brew install swiftlint
bundle install --without=development
grep -lR "shouldUseLaunchSchemeArgsEnv" *.* --null | xargs -0 sed -i '' -e 's/shouldUseLaunchSchemeArgsEnv = "YES"/shouldUseLaunchSchemeArgsEnv = "YES" codeCoverageEnabled = "YES"/g'
- run:
name: Bootstrap
command: carthage bootstrap --platform mac
- run:
name: Setup Keychain
command: |
security create-keychain -p circle cikeychain
security list-keychains -d user -s "/Users/distiller/Library/Keychains/xcode.keychain-db" /Users/distiller/Library/Keychains/cikeychain-db
security default-keychain -s /Users/distiller/Library/Keychains/cikeychain-db
security unlock-keychain -p circle "/Users/distiller/Library/Keychains/cikeychain-db"
- run:
name: Run test suite
command: xcodebuild test -scheme Auth0.macOS -destination 'platform=macOS,arch=x86_64' | xcpretty
- save_cache:
key: dependency-cache
paths:
- Carthage/Build
build-and-test-tvOS-swift-4.2:
macos:
xcode: "10.0.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
steps:
- checkout
- run: |
brew install swiftlint
bundle install --without=development
grep -lR "shouldUseLaunchSchemeArgsEnv" *.* --null | xargs -0 sed -i '' -e 's/shouldUseLaunchSchemeArgsEnv = "YES"/shouldUseLaunchSchemeArgsEnv = "YES" codeCoverageEnabled = "YES"/g'
- run:
name: Bootstrap
command: carthage bootstrap --platform tvOS
- run:
name: Run test suite
command: xcodebuild test -scheme Auth0.tvOS -destination 'platform=tvOS Simulator,name=Apple TV' | xcpretty
- save_cache:
key: dependency-cache
paths:
- Carthage/Build

workflows:
version: 2
build-test-report:
build-test:
jobs:
- build-and-test
- build-and-test-iOS-swift-4.2
- build-and-test-iOS-swift-4.0
- build-and-test-iOS-swift-3.0
- build-and-test-macOS-swift-4.2
- build-and-test-tvOS-swift-4.2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ DerivedData/
*.perspectivev3
!default.perspectivev3
xcuserdata/
Auth0.xcodeproj/project.xcworkspace/xcshareddata/

## Other
*.moved-aside
Expand Down
12 changes: 9 additions & 3 deletions App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@
import UIKit
import Auth0

#if swift(>=4.2)
typealias A0ApplicationLaunchOptionsKey = UIApplication.LaunchOptionsKey
#else
typealias A0ApplicationLaunchOptionsKey = UIApplicationLaunchOptionsKey
#endif

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [A0ApplicationLaunchOptionsKey: Any]?) -> Bool {
return true
}

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
func application(_ app: UIApplication, open url: URL, options: [A0URLOptionsKey : Any]) -> Bool {
return Auth0.resumeAuth(url, options: options)
}
}
Expand Down
44 changes: 22 additions & 22 deletions Auth0.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1985,7 +1985,7 @@
SDKROOT = appletvos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down Expand Up @@ -2018,7 +2018,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down Expand Up @@ -2054,7 +2054,7 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand Down Expand Up @@ -2087,7 +2087,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down Expand Up @@ -2144,7 +2144,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -2197,7 +2197,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -2231,7 +2231,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand Down Expand Up @@ -2260,7 +2260,7 @@
PRODUCT_NAME = Auth0;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down Expand Up @@ -2293,7 +2293,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand Down Expand Up @@ -2325,7 +2325,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -2350,7 +2350,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "Auth0Tests/Auth0Tests.iOS-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2.app/OAuth2";
};
name = Debug;
Expand All @@ -2375,7 +2375,7 @@
PRODUCT_NAME = Auth0Tests;
SWIFT_OBJC_BRIDGING_HEADER = "Auth0Tests/Auth0Tests.iOS-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2.app/OAuth2";
};
name = Release;
Expand All @@ -2402,7 +2402,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "Auth0Tests/Auth0Tests.OSX-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2Mac.app/Contents/MacOS/OAuth2Mac";
};
name = Debug;
Expand All @@ -2428,7 +2428,7 @@
SDKROOT = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "Auth0Tests/Auth0Tests.OSX-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2Mac.app/Contents/MacOS/OAuth2Mac";
};
name = Release;
Expand All @@ -2455,7 +2455,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.2;
};
Expand Down Expand Up @@ -2483,7 +2483,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.2;
};
Expand Down Expand Up @@ -2512,7 +2512,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
Expand Down Expand Up @@ -2540,7 +2540,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
Expand All @@ -2563,7 +2563,7 @@
PRODUCT_NAME = Auth0Tests;
SDKROOT = appletvos;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2TV.app/OAuth2TV";
TVOS_DEPLOYMENT_TARGET = 9.2;
};
Expand All @@ -2586,7 +2586,7 @@
PRODUCT_NAME = Auth0Tests;
SDKROOT = appletvos;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2TV.app/OAuth2TV";
TVOS_DEPLOYMENT_TARGET = 9.2;
};
Expand All @@ -2613,7 +2613,7 @@
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -2637,7 +2637,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Auth0Tests/NativeAuthSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class MockNativeAuthTransaction: NativeAuthTransaction {
self.delayed = { _ in }
}

func resume(_ url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
func resume(_ url: URL, options: [A0URLOptionsKey : Any]) -> Bool {
self.delayed(self.onNativeAuth())
self.delayed = { _ in }
return true
Expand Down
Loading