Support for SPM package projects in fastlane scan #17362
Replies: 10 comments 1 reply
-
I would like to build a little on this as I have found all the similar issues. The When building a swift package on the command line with Xcode automatically generates a To test:
Would be great to see this functionality added where the project or workspace can be specified as optional. Link to the mandatory fields for scan here Same issue with xcov |
Beta Was this translation helpful? Give feedback.
-
This is also a problem for any Swift 5.3+ packages that use xib resources. Allowing Fastlane scan to work without an xcodeproj but requiring a scheme if a Package.swift is present would solve this problem. |
Beta Was this translation helpful? Give feedback.
-
Issue #17734 is the one to watch for the |
Beta Was this translation helpful? Give feedback.
-
I was managed to build a package for iOS with some
it will be nice if
|
Beta Was this translation helpful? Give feedback.
-
Thank you for sharing this post i had the issue which i got solved thanks buddy.. |
Beta Was this translation helpful? Give feedback.
-
Is there any actual documentation on how to make fastlane scan work with standalone swift package? Like tutorial style? I can't make any sense from the docs.fastlane.tools regarding such a thing. I see this merged: |
Beta Was this translation helpful? Give feedback.
-
This is more or less the minimum set of options needed to run tests on a Swift package. This assumes that the Package.swift is in the same folder as your fastlane folder, and your package is named "YourPackageName".
If your package supports iOS/tvOS/iPadOS/watchOS you can supply the
|
Beta Was this translation helpful? Give feedback.
-
They've finally removed generate-xcodeproj from the "swift package" command in Xcode 14.3.1. Meaning we cannot generate project files anymore for swift packages. How do we get around this? There is a "swift test" command but it expects to run for macos too and I'm not supporting that. There doesn't seem to be a way to build/test just for iOS platforms. |
Beta Was this translation helpful? Give feedback.
-
I did a bit of research on how to run tests from the CLI using xcodebuild without a project/workspace file and also looked under the hood with how scan generates the xcodebuild command and came to this conclusion as to how to automate unit tests (on CircleCI) for a pure Swift package:
Works like a charm! |
Beta Was this translation helpful? Give feedback.
-
As of my last update in January 2022, Fastlane's
Remember to replace While |
Beta Was this translation helpful? Give feedback.
-
Summary
Currently it seems that you cannot use fastlane scan for pure SPM package projects i.e. projects that only use a Package.swift and no Xcode project.
Reasoning
When developing SPM packages for iOS, you cannot use "swift build" or "swift test" to compile or test your package. Instead you have to use xcodebuild. Therefore also fastlane spm cannot be used.
For building a package "fastlane xcodebuild" can be used, but with regards to testing the user is left on his own (e.g. no pretty test results as html etc.)
Current status
fastlane scan expects either a Xcode workspace or project file, which it validates upfront. Therefore there is no way clean way to get fastlane scan to work with only a Package.swift
However xcodebuild itself works as intended if only a Package.swift is present.
Proposal
Related issues
We were able to circumvent the aforementioned restrictions by using a custom script instead of the xcodebuild command. There we noticed some "command timed out" messages which seemed to happen while xcodebuild resolved other SPM dependencies. We already know these from older fastlane versions in conjunction with fastlane gym. Our current fastlane version have them resolved in gym, but it still seems to persist in fastlane scan.
We are currently using fastlane 2.162.0
Beta Was this translation helpful? Give feedback.
All reactions