setup-xcode
setup-xcode copied to clipboard
Use `.xcode-version` file
I am using fastlane and chxcode, and they read Xcode's version from the .xcode-version
file.
How about making this action read version from the file?
If it comes true, the '.xcode-version' file becomes SSOT, Single Source of Truth for the version of Xcode. I think it could become a part of the best practice for iOS engineers.
Thanks.
Hi 👋 , One possible problem that I see here is different syntax format.
This action uses semver notation. Fastlane docs describes the different notation (Gem::Version notation I guess?). For example:
-
8.1
will be resolved to8.1.0
by fastlane and as8.1.*
(for example8.1.2
as latest available) in this action -
~> 8.1.0
is not semver notation and won't work at all. And I guess some other differences
it can cause confusion and different selected Xcode. Correct me if I am wrong.
@maxim-lobanov:
Fastlane docs describes the different notation ([Gem::Version notation (https://www.rubydoc.info/github/rubygems/rubygems/Gem/Version) I guess?).
I believe the idea of the .xcode-version
file comes from the (now defunct) fastlane ci project: https://github.com/fastlane/ci/blob/master/docs/xcode-version.md, and in the examples there only a plain version number string is allowed, not any match syntax such as ~> 8.1.0
.
Also https://github.com/klaaspieter/chxcode, mentioned above, just matches on a plain string as far as I can see.
To alleviate this confusion, we could even add a (proposed) canonical description of the .xcode-version
file format to this repo. Especially so since is https://github.com/fastlane/ci/blob/master/docs/xcode-version.md is archived.
8.1 will be resolved to 8.1.0 by fastlane and as 8.1.* (for example 8.1.2 as latest available) in this action
I think we could see this as a bug in fastlane, and that setup-xcode
is doing the right thing.
Edit: we could also have setup-xcode
output a warning to the github action log in this case.
Related, there's also use of a .swift-version
file in the community, for example by SwiftFormat: https://github.com/nicklockwood/SwiftFormat/blob/master/README.md#swift-version
It could be interesting to make setup-xcode
select an Xcode version based on .swift-version
if .xcode-version
isn't present.
FYI if you want to get this feature right now you can use @bobergj's fork. Replace
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.3
with
- uses: nomasystems/[email protected]
in your Github Actions workflow yaml.