Skip to content

Commit 2e102e2

Browse files
authored
Run IOS Unit Tests On CI (#70)
Run IOS Unit Tests On CI
1 parent 354098f commit 2e102e2

File tree

4 files changed

+343
-2
lines changed

4 files changed

+343
-2
lines changed

.circleci/config.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,45 @@ jobs:
3939
- run:
4040
name: Run UnitTest
4141
command: ./gradlew test
42+
ios_test:
43+
macos:
44+
xcode: "10.2.0"
45+
working_directory: ~/project/example/ios
46+
environment:
47+
FL_OUTPUT_DIR: output
48+
steps:
49+
- checkout:
50+
path: ~/project
51+
- restore_cache:
52+
keys:
53+
- flutter-cache
54+
- run:
55+
name: download flutter SDK
56+
command: if ! test -f "flutter_sdk.zip"; then curl -o flutter_sdk.zip https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_v1.5.4-hotfix.2-stable.zip; fi
57+
- run:
58+
name: unzip flutter SDK
59+
command: unzip flutter_sdk.zip
60+
- run:
61+
name: export flutter path
62+
command: echo 'export PATH="$PATH:`pwd`/flutter/bin"' >> $BASH_ENV
63+
- run:
64+
name: Fetch CocoaPods Specs
65+
command: curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
66+
- run: flutter doctor
67+
- run:
68+
name: Flutter build
69+
command: cd ..; flutter build aot
70+
- run:
71+
name: Install CocoaPods
72+
command: pod install
73+
- run:
74+
name: Build and run tests
75+
command: xcodebuild -workspace Runner.xcworkspace -scheme Runner -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone X,OS=12.2' test | xcpretty
76+
- save_cache:
77+
key: flutter-cache
78+
paths:
79+
- flutter_sdk.zip
80+
- Pods
4281
release:
4382
docker:
4483
- image: cirrusci/flutter
@@ -52,6 +91,7 @@ workflows:
5291
jobs:
5392
- build
5493
- android_test
94+
- ios_test
5595
- hold:
5696
type: approval
5797
requires:

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,19 @@
2020
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
2121
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
2222
999354DC0E63372C73A68B4C /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9EBB397F99FB54015C87211 /* libPods-Runner.a */; };
23+
A0CE77B4227B03D600DE990D /* instabug_flutter_exampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A0CE77B3227B03D600DE990D /* instabug_flutter_exampleTests.m */; };
2324
/* End PBXBuildFile section */
2425

26+
/* Begin PBXContainerItemProxy section */
27+
A0CE77B6227B03D600DE990D /* PBXContainerItemProxy */ = {
28+
isa = PBXContainerItemProxy;
29+
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
30+
proxyType = 1;
31+
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
32+
remoteInfo = Runner;
33+
};
34+
/* End PBXContainerItemProxy section */
35+
2536
/* Begin PBXCopyFilesBuildPhase section */
2637
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
2738
isa = PBXCopyFilesBuildPhase;
@@ -56,6 +67,9 @@
5667
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5768
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5869
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
70+
A0CE77B1227B03D600DE990D /* instabug_flutter_exampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = instabug_flutter_exampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
71+
A0CE77B3227B03D600DE990D /* instabug_flutter_exampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = instabug_flutter_exampleTests.m; sourceTree = "<group>"; };
72+
A0CE77B5227B03D600DE990D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5973
A9EBB397F99FB54015C87211 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
6074
BAC4880E1C40979FFB98D02A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
6175
/* End PBXFileReference section */
@@ -71,6 +85,13 @@
7185
);
7286
runOnlyForDeploymentPostprocessing = 0;
7387
};
88+
A0CE77AE227B03D600DE990D /* Frameworks */ = {
89+
isa = PBXFrameworksBuildPhase;
90+
buildActionMask = 2147483647;
91+
files = (
92+
);
93+
runOnlyForDeploymentPostprocessing = 0;
94+
};
7495
/* End PBXFrameworksBuildPhase section */
7596

7697
/* Begin PBXGroup section */
@@ -110,6 +131,7 @@
110131
children = (
111132
9740EEB11CF90186004384FC /* Flutter */,
112133
97C146F01CF9000F007C117D /* Runner */,
134+
A0CE77B2227B03D600DE990D /* instabug_flutter_exampleTests */,
113135
97C146EF1CF9000F007C117D /* Products */,
114136
13077D31F6E12C6C6AA74720 /* Pods */,
115137
33DBEB55B5A19F5D2F047D84 /* Frameworks */,
@@ -120,6 +142,7 @@
120142
isa = PBXGroup;
121143
children = (
122144
97C146EE1CF9000F007C117D /* Runner.app */,
145+
A0CE77B1227B03D600DE990D /* instabug_flutter_exampleTests.xctest */,
123146
);
124147
name = Products;
125148
sourceTree = "<group>";
@@ -148,6 +171,15 @@
148171
name = "Supporting Files";
149172
sourceTree = "<group>";
150173
};
174+
A0CE77B2227B03D600DE990D /* instabug_flutter_exampleTests */ = {
175+
isa = PBXGroup;
176+
children = (
177+
A0CE77B3227B03D600DE990D /* instabug_flutter_exampleTests.m */,
178+
A0CE77B5227B03D600DE990D /* Info.plist */,
179+
);
180+
path = instabug_flutter_exampleTests;
181+
sourceTree = "<group>";
182+
};
151183
/* End PBXGroup section */
152184

153185
/* Begin PBXNativeTarget section */
@@ -173,18 +205,42 @@
173205
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
174206
productType = "com.apple.product-type.application";
175207
};
208+
A0CE77B0227B03D600DE990D /* instabug_flutter_exampleTests */ = {
209+
isa = PBXNativeTarget;
210+
buildConfigurationList = A0CE77BB227B03D600DE990D /* Build configuration list for PBXNativeTarget "instabug_flutter_exampleTests" */;
211+
buildPhases = (
212+
A0CE77AD227B03D600DE990D /* Sources */,
213+
A0CE77AE227B03D600DE990D /* Frameworks */,
214+
A0CE77AF227B03D600DE990D /* Resources */,
215+
);
216+
buildRules = (
217+
);
218+
dependencies = (
219+
A0CE77B7227B03D600DE990D /* PBXTargetDependency */,
220+
);
221+
name = instabug_flutter_exampleTests;
222+
productName = instabug_flutter_exampleTests;
223+
productReference = A0CE77B1227B03D600DE990D /* instabug_flutter_exampleTests.xctest */;
224+
productType = "com.apple.product-type.bundle.unit-test";
225+
};
176226
/* End PBXNativeTarget section */
177227

178228
/* Begin PBXProject section */
179229
97C146E61CF9000F007C117D /* Project object */ = {
180230
isa = PBXProject;
181231
attributes = {
232+
DefaultBuildSystemTypeForWorkspace = Original;
182233
LastUpgradeCheck = 0910;
183234
ORGANIZATIONNAME = "The Chromium Authors";
184235
TargetAttributes = {
185236
97C146ED1CF9000F007C117D = {
186237
CreatedOnToolsVersion = 7.3.1;
187238
};
239+
A0CE77B0227B03D600DE990D = {
240+
CreatedOnToolsVersion = 10.1;
241+
ProvisioningStyle = Automatic;
242+
TestTargetID = 97C146ED1CF9000F007C117D;
243+
};
188244
};
189245
};
190246
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
@@ -201,6 +257,7 @@
201257
projectRoot = "";
202258
targets = (
203259
97C146ED1CF9000F007C117D /* Runner */,
260+
A0CE77B0227B03D600DE990D /* instabug_flutter_exampleTests */,
204261
);
205262
};
206263
/* End PBXProject section */
@@ -218,6 +275,13 @@
218275
);
219276
runOnlyForDeploymentPostprocessing = 0;
220277
};
278+
A0CE77AF227B03D600DE990D /* Resources */ = {
279+
isa = PBXResourcesBuildPhase;
280+
buildActionMask = 2147483647;
281+
files = (
282+
);
283+
runOnlyForDeploymentPostprocessing = 0;
284+
};
221285
/* End PBXResourcesBuildPhase section */
222286

223287
/* Begin PBXShellScriptBuildPhase section */
@@ -310,8 +374,24 @@
310374
);
311375
runOnlyForDeploymentPostprocessing = 0;
312376
};
377+
A0CE77AD227B03D600DE990D /* Sources */ = {
378+
isa = PBXSourcesBuildPhase;
379+
buildActionMask = 2147483647;
380+
files = (
381+
A0CE77B4227B03D600DE990D /* instabug_flutter_exampleTests.m in Sources */,
382+
);
383+
runOnlyForDeploymentPostprocessing = 0;
384+
};
313385
/* End PBXSourcesBuildPhase section */
314386

387+
/* Begin PBXTargetDependency section */
388+
A0CE77B7227B03D600DE990D /* PBXTargetDependency */ = {
389+
isa = PBXTargetDependency;
390+
target = 97C146ED1CF9000F007C117D /* Runner */;
391+
targetProxy = A0CE77B6227B03D600DE990D /* PBXContainerItemProxy */;
392+
};
393+
/* End PBXTargetDependency section */
394+
315395
/* Begin PBXVariantGroup section */
316396
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
317397
isa = PBXVariantGroup;
@@ -552,6 +632,82 @@
552632
};
553633
name = Release;
554634
};
635+
A0CE77B8227B03D600DE990D /* Debug */ = {
636+
isa = XCBuildConfiguration;
637+
buildSettings = {
638+
BUNDLE_LOADER = "$(TEST_HOST)";
639+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
640+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
641+
CLANG_ENABLE_OBJC_WEAK = YES;
642+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
643+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
644+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
645+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
646+
CODE_SIGN_IDENTITY = "iPhone Developer";
647+
CODE_SIGN_STYLE = Automatic;
648+
GCC_C_LANGUAGE_STANDARD = gnu11;
649+
INFOPLIST_FILE = instabug_flutter_exampleTests/Info.plist;
650+
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
651+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
652+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
653+
MTL_FAST_MATH = YES;
654+
PRODUCT_BUNDLE_IDENTIFIER = "a.instabug-flutter-exampleTests";
655+
PRODUCT_NAME = "$(TARGET_NAME)";
656+
TARGETED_DEVICE_FAMILY = "1,2";
657+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
658+
};
659+
name = Debug;
660+
};
661+
A0CE77B9227B03D600DE990D /* Release */ = {
662+
isa = XCBuildConfiguration;
663+
buildSettings = {
664+
BUNDLE_LOADER = "$(TEST_HOST)";
665+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
666+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
667+
CLANG_ENABLE_OBJC_WEAK = YES;
668+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
669+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
670+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
671+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
672+
CODE_SIGN_IDENTITY = "iPhone Developer";
673+
CODE_SIGN_STYLE = Automatic;
674+
GCC_C_LANGUAGE_STANDARD = gnu11;
675+
INFOPLIST_FILE = instabug_flutter_exampleTests/Info.plist;
676+
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
677+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
678+
MTL_FAST_MATH = YES;
679+
PRODUCT_BUNDLE_IDENTIFIER = "a.instabug-flutter-exampleTests";
680+
PRODUCT_NAME = "$(TARGET_NAME)";
681+
TARGETED_DEVICE_FAMILY = "1,2";
682+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
683+
};
684+
name = Release;
685+
};
686+
A0CE77BA227B03D600DE990D /* Profile */ = {
687+
isa = XCBuildConfiguration;
688+
buildSettings = {
689+
BUNDLE_LOADER = "$(TEST_HOST)";
690+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
691+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
692+
CLANG_ENABLE_OBJC_WEAK = YES;
693+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
694+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
695+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
696+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
697+
CODE_SIGN_IDENTITY = "iPhone Developer";
698+
CODE_SIGN_STYLE = Automatic;
699+
GCC_C_LANGUAGE_STANDARD = gnu11;
700+
INFOPLIST_FILE = instabug_flutter_exampleTests/Info.plist;
701+
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
702+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
703+
MTL_FAST_MATH = YES;
704+
PRODUCT_BUNDLE_IDENTIFIER = "a.instabug-flutter-exampleTests";
705+
PRODUCT_NAME = "$(TARGET_NAME)";
706+
TARGETED_DEVICE_FAMILY = "1,2";
707+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
708+
};
709+
name = Profile;
710+
};
555711
/* End XCBuildConfiguration section */
556712

557713
/* Begin XCConfigurationList section */
@@ -575,6 +731,16 @@
575731
defaultConfigurationIsVisible = 0;
576732
defaultConfigurationName = Release;
577733
};
734+
A0CE77BB227B03D600DE990D /* Build configuration list for PBXNativeTarget "instabug_flutter_exampleTests" */ = {
735+
isa = XCConfigurationList;
736+
buildConfigurations = (
737+
A0CE77B8227B03D600DE990D /* Debug */,
738+
A0CE77B9227B03D600DE990D /* Release */,
739+
A0CE77BA227B03D600DE990D /* Profile */,
740+
);
741+
defaultConfigurationIsVisible = 0;
742+
defaultConfigurationName = Release;
743+
};
578744
/* End XCConfigurationList section */
579745
};
580746
rootObject = 97C146E61CF9000F007C117D /* Project object */;

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,38 @@
2020
ReferencedContainer = "container:Runner.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "YES"
27+
buildForArchiving = "YES"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "A0CE77B0227B03D600DE990D"
32+
BuildableName = "instabug_flutter_exampleTests.xctest"
33+
BlueprintName = "instabug_flutter_exampleTests"
34+
ReferencedContainer = "container:Runner.xcodeproj">
35+
</BuildableReference>
36+
</BuildActionEntry>
2337
</BuildActionEntries>
2438
</BuildAction>
2539
<TestAction
2640
buildConfiguration = "Debug"
2741
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2842
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
language = ""
3043
shouldUseLaunchSchemeArgsEnv = "YES">
3144
<Testables>
45+
<TestableReference
46+
skipped = "NO">
47+
<BuildableReference
48+
BuildableIdentifier = "primary"
49+
BlueprintIdentifier = "A0CE77B0227B03D600DE990D"
50+
BuildableName = "instabug_flutter_exampleTests.xctest"
51+
BlueprintName = "instabug_flutter_exampleTests"
52+
ReferencedContainer = "container:Runner.xcodeproj">
53+
</BuildableReference>
54+
</TestableReference>
3255
</Testables>
3356
<MacroExpansion>
3457
<BuildableReference
@@ -46,7 +69,6 @@
4669
buildConfiguration = "Debug"
4770
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4871
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
49-
language = ""
5072
launchStyle = "0"
5173
useCustomWorkingDirectory = "NO"
5274
ignoresPersistentStateOnLaunch = "NO"

0 commit comments

Comments
 (0)