-
Notifications
You must be signed in to change notification settings - Fork 26
/
Rakefile
106 lines (91 loc) · 3.75 KB
/
Rakefile
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
100
101
102
103
104
105
106
namespace :build do
desc 'Builds the Lottie example app'
namespace :example do
desc 'Builds the Example apps for all supported platforms / architectures. Requires valid code signing.'
task all: ['iOS:simulator', 'iOS:device', 'tvOS:simulator', 'visionOS:simulator', 'macOS:arm64', 'macOS:x86_64', 'macCatalyst:arm64', 'macCatalyst:x86_64']
desc 'Builds the Example app for platforms / architectures supported by Github Actions CI'
task github_actions: ['iOS:simulator', 'tvOS:simulator', 'visionOS:simulator', 'macOS:x86_64']
namespace :iOS do
task :simulator do
xcodebuild('build -scheme "Example" -destination "platform=iOS Simulator,name=iPhone SE (3rd generation)" -workspace Example/Example.xcworkspace')
end
task :device do
xcodebuild('build -scheme "Example" -destination generic/platform=iOS -workspace Example/Example.xcworkspace')
end
end
namespace :tvOS do
task :simulator do
xcodebuild('build -scheme "Example" -destination "platform=tvOS Simulator,name=Apple TV 4K (3rd generation)" -workspace Example/Example.xcworkspace')
end
end
namespace :visionOS do
task :simulator do
ifVisionOSEnabled {
xcodebuild('build -scheme "Example" -destination "platform=visionOS Simulator,name=Apple Vision Pro" -workspace Example/Example.xcworkspace')
}
end
end
namespace :macOS do
task :arm64 do
xcodebuild('build -scheme "Example" -destination "platform=macOS,arch=arm64" -workspace Example/Example.xcworkspace')
end
task :x86_64 do
xcodebuild('build -scheme "Example" -destination "platform=macOS,arch=x86_64" -workspace Example/Example.xcworkspace')
end
end
namespace :macCatalyst do
task :arm64 do
xcodebuild('build -scheme "Example" -destination "platform=macOS,variant=Mac Catalyst,arch=arm64" -workspace Example/Example.xcworkspace')
end
task :x86_64 do
xcodebuild('build -scheme "Example" -destination "platform=macOS,variant=Mac Catalyst,arch=x86_64" -workspace Example/Example.xcworkspace')
end
end
end
end
namespace :test do
desc 'Tests the Lottie package for supported platforms'
namespace :package do
desc 'Tests the Lottie package for all supported platforms'
task all: ['iOS', 'macOS', 'tvOS', 'visionOS']
# The visionOS tests time out in GitHub actions as of Feb 2024, so we exclude them for now.
desc 'Tests the Lottie package for all platforms supported by GitHub Actions'
task github_actions: ['iOS', 'macOS', 'tvOS']
desc 'Tests the Lottie package for iOS'
task :iOS do
xcodebuild('test -scheme Lottie -destination "platform=iOS Simulator,name=iPhone SE (3rd generation)"')
end
desc 'Tests the Lottie package for macOS'
task :macOS do
xcodebuild('test -scheme Lottie -destination platform=macOS')
end
desc 'Tests the Lottie package for tvOS'
task :tvOS do
xcodebuild('test -scheme Lottie -destination "platform=tvOS Simulator,name=Apple TV"')
end
desc 'Tests the Lottie package for visionOS'
task :visionOS do
ifVisionOSEnabled {
xcodebuild('test -scheme Lottie -destination "platform=visionOS Simulator,name=Apple Vision Pro"')
}
end
end
end
def xcodebuild(command)
# Check if the mint tool is installed -- if so, pipe the xcodebuild output through xcbeautify
`which mint`
if $?.success?
sh "set -o pipefail && xcodebuild #{command} | mint run thii/[email protected]"
else
sh "xcodebuild #{command}"
end
end
# Runs the given code block, unless `SKIP_VISION_OS=true`.
# TODO: Remove this once CI only uses Xcode 15.2+.
def ifVisionOSEnabled
if ENV["SKIP_VISION_OS"] == "true"
puts "Skipping visionOS build"
else
yield
end
end