Skip to content

Commit

Permalink
Test example app under more Xcode versions
Browse files Browse the repository at this point in the history
  • Loading branch information
calda committed Jan 12, 2024
1 parent f4da9b1 commit 6480d5e
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 12 deletions.
44 changes: 40 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ main ]

jobs:
Test-package-macos-13:
test-package-excluding-visionOS:
name: "Test Package"
runs-on: macos-13
strategy:
Expand All @@ -18,7 +18,22 @@ jobs:
- '14.3' # Swift 5.8
- '15.0' # Swift 5.9
- '15.1' # Swift 5.9.2
- '15.2' # Swift 5.9.2 (first version with visionOS support, TODO: also test visionOS build)
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
with:
xcode: ${{ matrix.xcode }}
- name: Build Package
run: SKIP_VISION_OS=true bundle exec rake test:package:all

test-package-macos-13:
name: "Test Package"
runs-on: macos-13
strategy:
fail-fast: false
matrix:
xcode:
- '15.2' # Swift 5.9, first version with visionOS support
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
Expand All @@ -27,9 +42,30 @@ jobs:
- name: Build Package
run: bundle exec rake test:package:all

build-example:
build-example-excluding-visionOS:
name: "Build Example App"
runs-on: macos-13
strategy:
fail-fast: false
matrix:
xcode:
- '14.2' # Swift 5.7
- '14.3' # Swift 5.8
- '15.0' # Swift 5.9
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
- name: Build Example
run: SKIP_VISION_OS=true bundle exec rake build:example:github_actions

build-example-macos-13:
name: "Build Example App"
runs-on: macos-12
runs-on: macos-13
strategy:
fail-fast: false
matrix:
xcode:
- '15.2' # Swift 5.9, first version with visionOS support
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup
Expand Down
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let package = Package(
// Lottie from being embedded in the app product, causing the app to crash when
// ran on a physical device. As a workaround, we can include a stub target
// with at least one source file.
// https://github.com/apple/swift-package-manager/issues/6069
.target(name: "_LottieStub"),

.testTarget(
Expand Down
47 changes: 39 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,49 @@ 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', 'macOS:arm64', 'macOS:x86_64', 'macCatalyst:arm64', 'macCatalyst:x86_64']
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', 'macOS:x86_64']
task github_actions: ['iOS:simulator', 'tvOS:simulator', 'visionOS:simulator', 'macOS:x86_64']

namespace :iOS do
task :simulator do
xcodebuild('build -scheme "Example (iOS)" -destination "platform=iOS Simulator,name=iPhone SE (3rd generation)" -workspace Example/Example.xcworkspace')
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 (iOS)" -destination generic/platform=iOS -workspace Example/Example.xcworkspace')
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 (macOS)" -destination "platform=macOS,arch=arm64" -workspace Example/Example.xcworkspace')
xcodebuild('build -scheme "Example" -destination "platform=macOS,arch=arm64" -workspace Example/Example.xcworkspace')
end
task :x86_64 do
xcodebuild('build -scheme "Example (macOS)" -destination "platform=macOS,arch=x86_64" -workspace Example/Example.xcworkspace')
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 (iOS)" -destination "platform=macOS,variant=Mac Catalyst,arch=arm64" -workspace Example/Example.xcworkspace')
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 (iOS)" -destination "platform=macOS,variant=Mac Catalyst,arch=x86_64" -workspace Example/Example.xcworkspace')
xcodebuild('build -scheme "Example" -destination "platform=macOS,variant=Mac Catalyst,arch=x86_64" -workspace Example/Example.xcworkspace')
end
end
end
Expand All @@ -56,6 +70,13 @@ namespace :test do
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

Expand All @@ -69,3 +90,13 @@ def xcodebuild(command)
sh "xcodebuild #{command}"
end
end

# Runs the given code block, unless `SKIP_VISION_OS=true`.
# This can be removed once CI only uses Xcode 15+.
def ifVisionOSEnabled
if ENV["SKIP_VISION_OS"] == "true"
puts "Skipping visionOS build"
else
yield
end
end

0 comments on commit 6480d5e

Please sign in to comment.