Followed the installation procedure in readme.md for local dev machine and also set up a Mac Server with brew install swiftlint, following the same steps. Logging into the box, running swiftlint in a project dir, works okay.
Then created a Bot on the Mac Server running same Xcode version as Dev machine.
When running a build locally, Swiftlint works fine with the Build Phase configuration as per README.md. (the if statement...)
When running build on the Mac Server, integration throws that warning message "SwiftLint not installed, download from..." set in the if statement.
When I update the Build Phase to plain n00b and fail prone script:
#!/bin/sh
/usr/local/bin/swiftlint
The Bot Integration finishes fine, without errors (provided code is clean). Swiftlint runs fine as I've also pushed not-so-clean code and tested swiftlint against that - swiftlint warnings popped up in the integration log.
Any ideas how to manage that better?
Sounds like the Mac Server (whatever that means) doesn't have /usr/local/bin in its $PATH, causing the SwiftLint binary to not be found when running the build phase run script.
Sounds like it. And I've tested it before posting here. Swiftlint is in $PATH. If I use my local dev machine as a server, same thing. Funny that it lints at the same time it throws that warning.
(aw man, just realised I'm posting this with my work github account)
Funny that it lints at the same time it throws that warning.
What do you mean by this?
Oh poop, sorry, my bad, I worked on this with half my brain engaged and when running the build in CI (bot) the report seemed as if it ran swiftlint _and_ thrown a warning at the same time. I was wrong.
I gave up trying to find a _neat_ solution and now just test the absolute path in the build phase if statement, and also run the absolute path. It now works on dev and on CI.
Thanks.
Looks like this is a common issue with Xcode Server in general: https://honzadvorsky.com/articles/2015-08-17-17-30-xcode_server_tutorials_3_prebuild__postbuild_scripts/#2-1-search-path-issues
Most helpful comment
Looks like this is a common issue with Xcode Server in general: https://honzadvorsky.com/articles/2015-08-17-17-30-xcode_server_tutorials_3_prebuild__postbuild_scripts/#2-1-search-path-issues