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

Fix error output on Linux #333

Merged
merged 5 commits into from
Nov 29, 2021
Merged

Conversation

sidepelican
Copy link
Contributor

Motivation

On linux, this action makes an error log every time.

example: https://github.com/fwal/setup-swift/actions/runs/1506129234

Integrate Swift 5.5 on ubuntu-latest
Failed to setup requested swift version

I want to calm down the error logs.

Reason

getVersion function anytime returns nullon linux .
The regex searches Apple Swift version.

https://github.com/fwal/setup-swift/blob/a94947b51dc16f23683cbdded9b5313f716b04b9/src/get-version.ts#L32

But the output of swift --verion on Linux does not contains Apple keyword.

macOS:

$ swift --version     
swift-driver version: 1.26.9 Apple Swift version 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6)
Target: x86_64-apple-macosx12.0

Linux(running on docker for mac):

$ docker run -it --rm swift:5.5 /usr/bin/swift --version
Swift version 5.5.1 (swift-5.5.1-RELEASE)
Target: x86_64-unknown-linux-gnu

How to fixed

just removed Apple keyword from the regex.

@fwal
Copy link
Collaborator

fwal commented Nov 29, 2021

Hi @sidepelican and thanks for the PR!

Could we add a test case with the output from linux to avoid any regressions of this in the future? 🙂
You can add it in /__tests__/get-version.test.ts
Then, to fix the linting issues please run npm run format and commit the changes. 👍🏻

@fwal fwal added the bug Something isn't working label Nov 29, 2021
@sidepelican
Copy link
Contributor Author

Thanks for the review!
I add test case and formatted.

@fwal
Copy link
Collaborator

fwal commented Nov 29, 2021

Nice! 👍🏻

@fwal fwal merged commit dea3ae0 into swift-actions:main Nov 29, 2021
@sidepelican sidepelican deleted the versioncheck branch November 30, 2021 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants