Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use .xcode-version file #47

Open
acevif opened this issue Oct 1, 2022 · 3 comments · May be fixed by #61
Open

Use .xcode-version file #47

acevif opened this issue Oct 1, 2022 · 3 comments · May be fixed by #61

Comments

@acevif
Copy link

acevif commented Oct 1, 2022

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.

@maxim-lobanov
Copy link
Owner

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 to 8.1.0 by fastlane and as 8.1.* (for example 8.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.

@bobergj
Copy link

bobergj commented Feb 21, 2023

@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.

@mplorentz
Copy link

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/action-xcode-select@v0.1

in your Github Actions workflow yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants