Skip to content

Commit

Permalink
Fix watchOS error and update CI to contain watchOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Aug 11, 2020
1 parent 14719e0 commit 4e512d3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ jobs:
runs-on: macOS-latest
strategy:
matrix:
destination: ['macOS', 'iOS Simulator,name=iPhone 8', 'tvOS Simulator,name=Apple TV']
destination: [
'macOS',
'iOS Simulator,name=iPhone 8',
'tvOS Simulator,name=Apple TV',
'watchOS Simulator,name=Apple Watch Series 5 - 40mm'
]
swift-version: [5.0, 4.2, 4.0]
steps:
- uses: actions/checkout@v1
Expand Down
3 changes: 3 additions & 0 deletions Sources/Extensions/NSTextAttachment+Kingfisher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#if !os(watchOS)

#if os(macOS)
import AppKit
Expand Down Expand Up @@ -252,3 +253,5 @@ extension KingfisherWrapper where Base: NSTextAttachment {
set { setRetainedAssociatedObject(base, &imageTaskKey, newValue)}
}
}

#endif
44 changes: 29 additions & 15 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,49 @@ platform :ios do
desc "Runs all the tests"
lane :tests do
test(destination: "platform=macOS", swift_version: "5.0")
test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "5.0")
test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "5.0")

test(destination: "platform=macOS", swift_version: "4.2")
test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "4.2")
test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "4.2")

test(destination: "platform=macOS", swift_version: "4.0")

test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "5.0")
test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "4.2")
test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "4.0")

test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "5.0")
test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "4.2")
test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "4.0")

build(destination: "platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm", swift_version: "4.0")
build(destination: "platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm", swift_version: "4.2")
build(destination: "platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm", swift_version: "5.0")
end

lane :test do |options|
_test(options)

lane :test_ci do
if ENV["DESTINATION"].include? "watchOS" then
build_watch_os(destination: ENV["DESTINATION"], swift_version: ENV["SWIFT_VERSION"])
else
test(destination: ENV["DESTINATION"], swift_version: ENV["SWIFT_VERSION"])
end
end
private_lane :_test do |options|

lane :test do |options|
scan(
scheme: "Kingfisher",
clean: true,
xcargs: "SWIFT_VERSION=#{options[:swift_version]}",
destination: options[:destination]
)
end

lane :test_ci do
test(destination: ENV["DESTINATION"], swift_version: ENV["SWIFT_VERSION"])

lane :build do |options|
gym(
workspace: "Kingfisher.xcworkspace",
configuration: "Debug",
scheme: "Kingfisher",
xcargs: "SWIFT_VERSION=#{options[:swift_version]}",
destination: options[:destination]
)
end

desc "Lint"
lane :lint do
carthage(command: "build", no_skip_current: true, platform: "iOS")
Expand Down

0 comments on commit 4e512d3

Please sign in to comment.