Skip to content

Run CI tests in Release configuration #3741

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

Merged
merged 7 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
76 changes: 45 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,6 @@ step-library:
command: |
for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts

- &build-Example
run:
name: Build Example
command: |
xcodebuild -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=14.5,name=iPhone 8 Plus' -project MapboxNavigation-SPM.xcodeproj -scheme Example clean build

- &trigger-metrics
run:
name: Trigger metrics
Expand All @@ -270,10 +264,10 @@ jobs:
default: false
iOS:
type: string
default: "14.5"
default: "15.2"
xcode:
type: string
default: "12.5.1"
default: "13.2.1"
lint:
type: boolean
default: false
Expand Down Expand Up @@ -301,7 +295,7 @@ jobs:
condition: << parameters.update >>
steps:
- run: cd Tests/CocoaPodsTest/PodInstall && bundle exec pod install --repo-update
- run: cd Tests/CocoaPodsTest/PodInstall && xcodebuild -workspace PodInstall.xcworkspace -scheme PodInstall -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=iPhone 8 Plus' clean build
- run: cd Tests/CocoaPodsTest/PodInstall && xcodebuild -workspace PodInstall.xcworkspace -scheme PodInstall -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=iPhone 13 Pro Max' clean build
- when:
condition: << parameters.archive >>
steps:
Expand Down Expand Up @@ -340,6 +334,9 @@ jobs:
verify_localization:
type: boolean
default: true
configuration:
type: string
default: "Debug"
macos:
xcode: << parameters.xcode >>
environment:
Expand Down Expand Up @@ -374,7 +371,7 @@ jobs:
xcode: << parameters.xcode >>
- run:
name: MapboxCoreNavigation
command: xcodebuild -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=<< parameters.device >>' -project MapboxNavigation.xcodeproj -scheme MapboxCoreNavigation clean build <<# parameters.test >>test <</ parameters.test >> <<# parameters.codecoverage >>-enableCodeCoverage YES<</ parameters.codecoverage >>
command: xcodebuild -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=<< parameters.device >>' -project MapboxNavigation.xcodeproj -scheme MapboxCoreNavigation -configuration << parameters.configuration >> clean build <<# parameters.test >>test <</ parameters.test >> <<# parameters.codecoverage >>-enableCodeCoverage YES<</ parameters.codecoverage >> ENABLE_TESTABILITY=YES
- when:
condition: << parameters.spm >>
steps:
Expand All @@ -383,7 +380,7 @@ jobs:
command: rm -rf *.xcodeproj
- run:
name: MapboxNavigation-Package
command: xcodebuild -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=<< parameters.device >>' -scheme MapboxNavigation-Package build <<# parameters.test >>test <</ parameters.test >> <<# parameters.codecoverage >>-enableCodeCoverage YES<</ parameters.codecoverage >>
command: xcodebuild -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=<< parameters.device >>' -scheme MapboxNavigation-Package -configuration << parameters.configuration >> build <<# parameters.test >>test <</ parameters.test >> <<# parameters.codecoverage >>-enableCodeCoverage YES<</ parameters.codecoverage >> ENABLE_TESTABILITY=YES
- when:
condition: << parameters.codecoverage >>
steps:
Expand All @@ -393,11 +390,11 @@ jobs:
- notify-build-finished


xcode-12-examples:
build-example:
parameters:
xcode:
type: string
default: "12.5.1"
default: "13.2.1"
spm:
type: boolean
default: true
Expand All @@ -410,9 +407,10 @@ jobs:
- *prepare-mapbox-file
- *prepare-netrc-file
- *add-github-to-known-hosts
- *build-Example
- run:
name: Build Example app
command: xcodebuild -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=15.2,name=iPhone 13 Pro Max' -project MapboxNavigation-SPM.xcodeproj -scheme Example clean build
- notify-build-finished


ios-trigger-metrics:
parameters:
Expand Down Expand Up @@ -677,34 +675,51 @@ workflows:
main-workflow:
jobs:
- build-job:
name: "Xcode_12.5.1_iOS_14.5"
xcode: "12.5.1"
iOS: "14.5"
device: "iPhone 12 Pro Max"
name: "Xcode_13.2.1_iOS_15.2_Debug"
xcode: "13.2.1"
iOS: "15.2"
device: "iPhone 13 Pro Max"
context: Slack Orb
- build-job:
name: "Xcode_12.5.1_iOS_14.5_SPM"
xcode: "12.5.1"
iOS: "14.5"
device: "iPhone 12 Pro Max"
name: "Xcode_13.2.1_iOS_15.2_SPM_Debug"
xcode: "13.2.1"
iOS: "15.2"
device: "iPhone 13 Pro Max"
spm: true
codecoverage: false
context: Slack Orb
- build-job:
name: "Xcode_13.2.1_iOS_15.2_Release"
xcode: "13.2.1"
iOS: "15.2"
device: "iPhone 13 Pro Max"
context: Slack Orb
configuration: "Release"
- build-job:
name: "Xcode_13.2.1_iOS_15.2_SPM_Release"
xcode: "13.2.1"
iOS: "15.2"
device: "iPhone 13 Pro Max"
spm: true
codecoverage: false
context: Slack Orb
configuration: "Release"
- pod-job:
name: "Xcode_12.5_iOS_14.5_CP_install"
name: "Xcode_13.2.1_iOS_15.2_CP_install"
update: false
xcode: "12.5.0"
iOS: "14.5"
xcode: "13.2.1"
iOS: "15.2"
archive: true
context: Slack Orb
- pod-job:
name: "Xcode_12.5_iOS_14.5_CP_update"
name: "Xcode_13.2.1_iOS_15.2_CP_update"
update: true
xcode: "12.5.0"
iOS: "14.5"
xcode: "13.2.1"
iOS: "15.2"
lint: true
context: Slack Orb
- xcode-12-examples:
- build-example:
name: "Build Example"
context: Slack Orb
- spm-test-job:
name: "swift test; Xcode 12.5; iOS 14.5"
Expand All @@ -720,7 +735,6 @@ workflows:
filters:
tags:
only: /^v\d+\.\d+\.\d+(-.+)?$/

- ios-trigger-metrics:
filters:
branches:
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ The .strings files should still be in the original English – that’s expecte
### Supported devices:
- iPhone 11 Pro Max, iOS 13.7
- iPhone 12 Pro Max, iOS 14.4
- iPhone 13 Pro Max, iOS 15.2

### Adding a unit test suite

Expand Down
4 changes: 2 additions & 2 deletions Tests/MapboxNavigationTests/NavigationCameraTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ class NavigationCameraTests: TestCase {
XCTAssertFalse(animatorPitch.isRunning, "Pitch animator should not be running.")
}

#if arch(x86_64)
#if arch(x86_64) && DEBUG
func testNavigationCameraFollowingCameraOptionsZoomRanges() {
let navigationMapView = NavigationMapView(frame: .zero)
guard let navigationViewportDataSource = navigationMapView.navigationCamera.viewportDataSource as? NavigationViewportDataSource else {
Expand All @@ -628,7 +628,7 @@ class NavigationCameraTests: TestCase {
}
#endif

#if arch(x86_64)
#if arch(x86_64) && DEBUG
// NOTE: We are running this test only on arch(x86_64) because `throwAssertion` doesn't work on ARM chips.
func testNavigationCameraOverviewCameraOptionsMaximumZoomLevel() {
let navigationMapView = NavigationMapView(frame: .zero)
Expand Down
4 changes: 3 additions & 1 deletion Tests/MapboxNavigationTests/SKUTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import MapboxSpeech
import MapboxNavigation
import MapboxCommon_Private

#if DEBUG
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also add a comment on why we don't run some tests in the Release configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the billing API used in these tests was already wrapped in #if DEBUG, for security reasons.

class SKUTests: TestCase {
private var navigator: MapboxCoreNavigation.Navigator? = nil

Expand All @@ -18,7 +19,7 @@ class SKUTests: TestCase {
super.tearDown()
navigator = nil
}

func testDirectionsSKU() {
let expected: String = UUID().uuidString
billingServiceMock.onGetSKUTokenIfValid = { _ in
Expand Down Expand Up @@ -66,3 +67,4 @@ class SKUTests: TestCase {
XCTAssertEqual(viewController.directionsToken, skuToken)
}
}
#endif
3 changes: 3 additions & 0 deletions Tests/MapboxNavigationTests/Snapshot++.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let snapshotDeviceName: String = {
.replacingOccurrences(of: ",", with: "_")
}()

let operatingSystemVersion: String = UIDevice.current.systemVersion

func assertImageSnapshot<Value, Format>(
matching value: @autoclosure () throws -> Value,
as snapshotting: Snapshotting<Value, Format>,
Expand All @@ -25,6 +27,7 @@ func assertImageSnapshot<Value, Format>(
.deletingLastPathComponent()
.appendingPathComponent("__Snapshots__")
.appendingPathComponent(snapshotDeviceName)
.appendingPathComponent(operatingSystemVersion)
.appendingPathComponent(fileName)

let failure = verifySnapshot(
Expand Down
3 changes: 2 additions & 1 deletion Tests/MapboxNavigationTests/TokenTestViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import MapboxNavigation
import MapboxDirections
import MapboxSpeech


#if DEBUG
class TokenTestViewController: UIViewController {

var mapViewToken: String?
Expand Down Expand Up @@ -61,3 +61,4 @@ class TokenTestViewController: UIViewController {
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class UserHaloCourseViewSnapshotTests: TestCase {

XCTAssertEqual(userHaloCourseView.layer.sublayers?.count, 1, "UserHaloCourseView should contain only one layer.")

assertImageSnapshot(matching: userHaloCourseView, as: .image(precision: 1.00))
assertImageSnapshot(matching: userHaloCourseView, as: .image(precision: 0.95))

userHaloCourseView.haloColor = .red
userHaloCourseView.haloRingColor = .yellow
userHaloCourseView.haloRadius = 20.0
userHaloCourseView.haloBorderWidth = 10.0

assertImageSnapshot(matching: userHaloCourseView, as: .image(precision: 1.00))
assertImageSnapshot(matching: userHaloCourseView, as: .image(precision: 0.95))
}

@available(iOS 13.0, *)
Expand Down
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.