actions / runner-images

GitHub Actions runner images
MIT License
10.1k stars 3.04k forks source link

Add SwiftFormat for macOS #3166

Closed lukasmalkmus closed 3 years ago

lukasmalkmus commented 3 years ago

Tool information

SwiftFormat goes above and beyond what you might expect from a code formatter. In addition to adjusting white space it can insert or remove implicit self, remove redundant parentheses, and correct many other deviations from the standard Swift idioms."

Area for Triage: Apple

Question, Bug, or Feature?: Feature

Virtual environments affected

Can this tool be installed during the build? Yes, brew install swiftformat

Tool installation time in runtime ~25sec

Are you willing to submit a PR? Yes

lukasmalkmus commented 3 years ago

I specifically need/want this for macOS. I don't know how common Swift development on Linux is. However, if the Ubuntu env has Homebrew installed as well, it is as simple to install on Ubuntu than it is on macOS.

Darleev commented 3 years ago

Hello @lukasmalkmus, We will consider adding this package. As soon as the final decision is ready, we will let you know.

AlenaSviridenko commented 3 years ago

Hi @lukasmalkmus, we already have few Swift formatter and linter tools, so we'd rather not add this new formatter. Please, use the following code to install it in runtime (it takes 2s without Homebrew):

wget https://github.com/nicklockwood/SwiftFormat/releases/download/0.47.13/swiftformat.zip
unzip swiftformat.zip
mv swiftformat /usr/local/bin/swiftformat
swiftformat --version

I am closing this issue, feel free to create a new one in case of any other questions.

lukasmalkmus commented 3 years ago

Unfortunate. Which formatters are installed? For macOS 11.0, none is actually listed, apart from SwiftLint (which I use, but it is a linter, not a formatter). Even the official formatter by Apple (swift-format) is not listed.

AlenaSviridenko commented 3 years ago

Sorry, my mistake, we don't have any formatter for Swift preinstalled on the image. Too many tools 😅 We'd like to add one then, and SwiftFormat seems to be more popular than swift-format, so I am re-opening the issue and moving it to our backlog. We will keep you posted with updates. Thanks!

miketimofeev commented 3 years ago

@lukasmalkmus we've added SwiftFormat to the images! The new image rollout will start on Monday and take 3-4 days.

lukasmalkmus commented 3 years ago

Thanks, appreciate the quick response and effort! 👍

miketimofeev commented 3 years ago

@lukasmalkmus the image with SwiftFormat 0.47.13 has been deployed! I'm going to close the issue. Please feel free to contact us if you have any concerns. Thank you!