forked from pocketsvg/PocketSVG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci.sh
99 lines (85 loc) · 3.15 KB
/
ci.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
89
90
91
92
93
94
95
96
97
98
99
## This file is part of the PocketSVG package.
# Copyright (c) Ponderwell, Ariel Elkin, Fjölnir Ásgeirsson, and Contributors
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
## This script builds the Swift Package, the iOS and macOS demos,
# and runs the tests on iOS. Our CI system requires that this script
# run successfully. It is called via .travis.yml and you can see
# the results over at https://travis-ci.org/pocketsvg/PocketSVG
#
# You can run this script locally before pushing your changes to
# check the build and tests run as they should.
# stop execution if an error occurs:
set -eo pipefail
# useful for development:
rm -rf .build/
rm -rf derived_data/
IOS_DESTINATION="platform=iOS Simulator,name=iPhone 11"
echo "Build iOS demo"
xcodebuild \
-workspace Demos/Demos.xcworkspace \
-destination "$IOS_DESTINATION" \
-scheme Demo-iOS \
-derivedDataPath derived_data \
'OTHER_LDFLAGS=$(inherited) -Liphoneos -lxml2' \
clean build | xcpretty
echo "Build macOS demo"
xcodebuild \
-workspace Demos/Demos.xcworkspace \
-destination "arch=x86_64" \
-derivedDataPath derived_data \
-scheme Demo-macOS \
'OTHER_LDFLAGS=$(inherited) -Liphoneos -lxml2' \
clean build | xcpretty
echo "Run unit tests"
xcodebuild \
-workspace Demos/Demos.xcworkspace \
-destination "$IOS_DESTINATION" \
-scheme Demo-iOS \
'OTHER_LDFLAGS=$(inherited) -Liphoneos -lxml2' \
clean test | xcpretty
PROJECT_PATH="derived_data/PocketSVG.xcodeproj"
MACOS_XCARCHIVE_PATH="derived_data/archives/PocketSVG-macOS.xcarchive"
IOS_SIMULATOR_XCARCHIVE_PATH="derived_data/archives/PocketSVG-iOS-Simulator.xcarchive"
IOS_DEVICE_XCARCHIVE_PATH="derived_data/archives/PocketSVG-iOS-Device.xcarchive"
XCFRAMEWORK_PATH="derived_data/xcframework/PocketSVG.xcframework"
echo "Build Swift Package"
swift build
echo "Build .xcframework"
swift package generate-xcodeproj --output $PROJECT_PATH
xcodebuild archive \
-project $PROJECT_PATH \
-scheme PocketSVG-Package \
-destination 'platform=OS X,arch=x86_64' \
-derivedDataPath derived_data \
-archivePath $MACOS_XCARCHIVE_PATH \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
| xcpretty
xcodebuild archive \
-project $PROJECT_PATH \
-scheme PocketSVG-Package \
-destination 'generic/platform=iOS' \
-derivedDataPath derived_data \
-archivePath $IOS_DEVICE_XCARCHIVE_PATH \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
| xcpretty
xcodebuild archive \
-project $PROJECT_PATH \
-scheme PocketSVG-Package \
-destination 'generic/platform=iOS Simulator' \
-derivedDataPath derived_data \
-archivePath $IOS_SIMULATOR_XCARCHIVE_PATH \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
| xcpretty
IOS_SIMULATOR_FRAMEWORK_PATH=$(find $IOS_SIMULATOR_XCARCHIVE_PATH -name "*.framework")
IOS_DEVICE_FRAMEWORK_PATH=$(find $IOS_DEVICE_XCARCHIVE_PATH -name "*.framework")
MACOS_FRAMEWORK_PATH=$(find $MACOS_XCARCHIVE_PATH -name "*.framework")
xcodebuild -create-xcframework \
-framework $IOS_SIMULATOR_FRAMEWORK_PATH \
-framework $IOS_DEVICE_FRAMEWORK_PATH \
-framework $MACOS_FRAMEWORK_PATH \
-output $XCFRAMEWORK_PATH