Recently something changed on GitHub Actions and we're not sure what happened or how to resolve it. We are testing and building iOS apps and have SwiftLint in place for our automatic PR checks.
For months our job configuration worked like a charm but about a 1.5 weeks ago things started to get flaky. Sometimes it runs through, sometimes it doesn't.
We used to have this in our run-tests.yml
file:
- name: Install SwiftLint
run: brew install swiftlint
9 days ago tests suddenly started to fail at this step. Here are the logs from GitHub Actions:
==> Pouring swiftlint-0.42.0.catalina.bottle.tar.gz
Error: The
brew link
step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/swiftlint Target /usr/local/bin/swiftlint already exists. You may want to remove it: rm '/usr/local/bin/swiftlint'To force the link and overwrite all conflicting files: brew link --overwrite swiftlint
To list all files that would be deleted: brew link --overwrite --dry-run swiftlint
Possible conflicting files are: /usr/local/bin/swiftlint
==> Summary ???? /usr/local/Cellar/swiftlint/0.42.0: 6 files, 12.2MB Error: Process completed with exit code 1.
After doing some research, looking at the error message and seeing that other jobs run through successfully (meaning SwiftLint could be installed properly) we decided to have a failsafe in place: try to link an existing SwiftLint and if that fails simply install it:
- name: Link SwiftLint or install it
run: brew link --overwrite swiftlint || brew install swiftlint
This worked for a few days and yesterday this cropped up again. The error logs confuse us so we decided to ask here whether others are experiencing this as well and how to solve this. Error logs:
Run brew link --overwrite swiftlint || brew install swiftlint
Error: No such keg: /usr/local/Cellar/swiftlint
==> Downloading https://homebrew.bintray.com/bottles/swiftlint-0.42.0.catalina.bottle.tar.gz
==> Pouring swiftlint-0.42.0.catalina.bottle.tar.gz
Error: The
brew link
step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/swiftlint Target /usr/local/bin/swiftlint already exists. You may want to remove it: rm '/usr/local/bin/swiftlint'To force the link and overwrite all conflicting files: brew link --overwrite swiftlint
To list all files that would be deleted: brew link --overwrite --dry-run swiftlint
Possible conflicting files are: /usr/local/bin/swiftlint ==> Summary ???? /usr/local/Cellar/swiftlint/0.42.0: 6 files, 12.2MB
Error: Process completed with exit code 1.
So first it says it can't link an existing SwiftLint. OK. Then it proceeds to download it.. and then it says it cannot link because it's already there?!
Sure we could go ahead and try the following:
- name: Link SwiftLint or install it
run: brew link --overwrite swiftlint || brew install swiftlint || brew link --overwrite swiftlint
But this seems too hacky and there must be some better solution to this.
Ideas and solutions very much appreciated.