forked from uber/ios-snapshot-test-case
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·88 lines (80 loc) · 3.42 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
set -eu
function ci_lib() {
NAME=$1
xcodebuild -project FBSnapshotTestCase.xcodeproj \
-scheme "FBSnapshotTestCase iOS" \
-destination "platform=iOS Simulator,name=${NAME}" \
-sdk iphonesimulator \
build-for-testing | xcbeautify
xcodebuild -project FBSnapshotTestCase.xcodeproj \
-scheme "FBSnapshotTestCase iOS" \
-destination "platform=iOS Simulator,name=${NAME}" \
-sdk iphonesimulator \
test-without-building | xcbeautify
}
function ci_demo() {
NAME=$1
pushd demos/FBSnapshotTestCaseDemo
pod install
xcodebuild -workspace FBSnapshotTestCaseDemo.xcworkspace \
-scheme FBSnapshotTestCaseDemo \
-destination "platform=iOS Simulator,name=${NAME}" \
build-for-testing | xcbeautify
xcodebuild -workspace FBSnapshotTestCaseDemo.xcworkspace \
-scheme FBSnapshotTestCaseDemo \
-destination "platform=iOS Simulator,name=${NAME}" \
test-without-building | xcbeautify
popd
}
function ci_demo_preprocessor() {
NAME=$1
pushd demos/FBSnapshotTestCaseDemo
pod install
xcodebuild -workspace FBSnapshotTestCaseDemo.xcworkspace \
-scheme FBSnapshotTestCasePreprocessorDemo \
-destination "platform=iOS Simulator,name=${NAME}" \
build-for-testing | xcbeautify
xcodebuild -workspace FBSnapshotTestCaseDemo.xcworkspace \
-scheme FBSnapshotTestCasePreprocessorDemo \
-destination "platform=iOS Simulator,name=${NAME}" \
test-without-building | xcbeautify
popd
}
function ci_carthage_demo() {
NAME=$1
pushd demos/iOSSnapshotTestCaseCarthageDemo
carthage bootstrap --no-use-binaries --use-xcframeworks # we're using --no-use-binaries because carthage's archive doesn't yet create xcframeworks, and we're using --use-xcframeworks because of Xcode 12
xcodebuild -project iOSSnapshotTestCaseCarthageDemo.xcodeproj \
-scheme iOSSnapshotTestCaseCarthageDemo \
-destination "platform=iOS Simulator,name=${NAME}" \
build-for-testing | xcbeautify
xcodebuild -project iOSSnapshotTestCaseCarthageDemo.xcodeproj \
-scheme iOSSnapshotTestCaseCarthageDemo \
-destination "platform=iOS Simulator,name=${NAME}" \
test-without-building | xcbeautify
popd
}
function ci_swiftpm_demo() {
NAME=$1
pushd demos/iOSSnapshotTestCaseSwiftPMDemo
xcodebuild -project iOSSnapshotTestCaseSwiftPMDemo.xcodeproj \
-scheme "iOSSnapshotTestCaseSwiftPMDemo (iOS)" \
-destination "platform=iOS Simulator,name=${NAME}" \
build-for-testing | xcbeautify
xcodebuild -project iOSSnapshotTestCaseSwiftPMDemo.xcodeproj \
-scheme "iOSSnapshotTestCaseSwiftPMDemo (iOS)" \
-destination "platform=iOS Simulator,name=${NAME}" \
test-without-building | xcbeautify
popd
}
function test_bazel() {
bazelisk test //src/iOSSnapshotTestCaseTests:iOSSnapshotTestCaseTests --test_output=all
}
ci_lib "iPhone 8" && ci_demo "iPhone 8" && ci_demo_preprocessor "iPhone 8"
ci_lib "iPhone 11" && ci_demo "iPhone 11" && ci_demo_preprocessor "iPhone 11"
ci_carthage_demo "iPhone 8"
ci_carthage_demo "iPhone 11"
ci_swiftpm_demo "iPhone 8"
ci_swiftpm_demo "iPhone 11"
test_bazel