-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
Why the execution of golangci-lint takes so much time #297
Comments
Just add more info if helps. 😃 My golangci-lint action recently 50% time failed because of timeout issue since a week ago. Mine is a small project too at this moment. Below are two pull requests which is not related to with Go part (defined in Here is when it is normal Running [/home/runner/golangci-lint-1.40.1-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=api-go] in [/home/runner/work/hongbomiao.com/hongbomiao.com/api-go] ...
golangci-lint found no issues
Ran golangci-lint in 6029ms And here is when it is slow Running [/home/runner/golangci-lint-1.40.1-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=api-go] in [/home/runner/work/hongbomiao.com/hongbomiao.com/api-go] ...
level=error msg="Timeout exceeded: try increasing it by passing --timeout option"
Error: golangci-lint exit with code 4
Ran golangci-lint in 71047ms As you see, both runs happen recently, however, when golangci-lint is slow, it can take a very long time. |
We are also increasingly seeing this behaviour in our builds. Is there anything I can do to help? |
Looks like golangci-lint github actions is taking more time than expected as reported at other projects [1]. This change increase the timeout to 3m. [1] golangci/golangci-lint-action#297 Signed-off-by: Quique Llorente <ellorent@redhat.com>
Looks like golangci-lint github actions is taking more time than expected as reported at other projects [1]. This change increase the timeout to 3m. [1] golangci/golangci-lint-action#297 Signed-off-by: Quique Llorente <ellorent@redhat.com>
CI Linting job fails intermittently due to timeout. Increase the timeout to 3m. The timeout issue and suggested solution can be found at golangci/golangci-lint-action#297 Also update the golangci-lint version to 1.42 since golangci-lint starts to build docker image with go1.17 with version 1.42.1. Signed-off-by: Jack Ding <jacding@redhat.com>
CI Linting job fails intermittently due to timeout. Increase the timeout to 3m. The timeout issue and suggested solution can be found at golangci/golangci-lint-action#297 Signed-off-by: Jack Ding <jacding@redhat.com>
There is an issue related to this: golangci/golangci-lint-action#297
CI Linting job fails intermittently due to timeout. Increase the timeout to 3m. The timeout issue and suggested solution can be found at golangci/golangci-lint-action#297 Also update the golangci-lint version to 1.42 since golangci-lint starts to build docker image with go1.17 with version 1.42.1. Signed-off-by: Jack Ding <jacding@redhat.com>
CI Linting job fails intermittently due to timeout. Increase the timeout to 3m. The timeout issue and suggested solution can be found at golangci/golangci-lint-action#297 Also update the golangci-lint version to 1.42 since golangci-lint starts to build docker image with go1.17 with version 1.42.1. Signed-off-by: Jack Ding <jacding@redhat.com> Co-authored-by: Jack Ding <jacding@redhat.com>
It really depends on the number of enabled linters. Some linters requires whole project to be loaded, other linters are just slow by their nature. lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
skip-go-installation: true
version: latest
args: --timeout 3m --verbose |
Increase golangci-lint-action timeout because the action takes a more than 1 minutes to run on GitHub's servers (golangci/golangci-lint-action#297). Enable verbose mode as well, so we can understand what's going on.
Increase golangci-lint-action timeout because the action takes a more than 1 minute to run on GitHub's servers (golangci/golangci-lint-action#297). Enable verbose mode as well, so we can understand what's going on.
Increase golangci-lint-action timeout because the action takes a more than 1 minute to run on GitHub's servers (golangci/golangci-lint-action#297). Enable verbose mode as well, so we can understand what's going on.
CI Linting job fails intermittently due to timeout. Increase the timeout to 3m. The timeout issue and suggested solution can be found at golangci/golangci-lint-action#297 Also update the golangci-lint version to 1.42 since golangci-lint starts to build docker image with go1.17 with version 1.42.1. Signed-off-by: Jack Ding <jacding@redhat.com> Co-authored-by: Jack Ding <jacding@redhat.com>
This comment was marked as off-topic.
This comment was marked as off-topic.
Here is the log of my github action:
As I said previously, locally it takes 3sec:
|
Updated to from version 1.50.1 to 1.51.1 divided execution time almost by 3 !
Thank you! |
Same here. Good job, guys! 👍 |
I found caching to be super slow (> 1minute):
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Cache may not be hitting like people expect. I was complaining about this issue and a colleague pointed out lack of cache makes the lint action take much longer than local. I confirmed by inserting a build step before the lint action step. This shifted module download time to the build and reduced lint run action time from 55s to 15s for my relatively small project. My understanding was golangci-lint uses the cache out of the box and setup-go@v4 enables cache by default, but we're missing something. Increasing timeout is an ok workaround but we plan to eventually dig further into build order and cache behavior to see why it's not hitting by default for our jobs.
|
This comment was marked as off-topic.
This comment was marked as off-topic.
In my case, it looks like the unusually long run times are due to network activity. The linter task often succeeds in under the default timeout, but periodically takes much longer. The failure cases typically include a long time in the E.g.
If I add a build step before linting, the
I've found this to be a suitable alternative to increasing the |
As others have mentioned, the issue appears to be much worse when linters are run in CI agents. Just take a look at the run on a laptop with a base model M1 cpu:
And the same run on a CI machine, which normally runs other CI commands faster than a Macbook:
I understand that the two machines aren't the same, but the runtime difference of almost 50x does raise some eyebrows. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I've noticed that post lint caching seems exceptionally slow. Note this (from https://github.com/evcc-io/evcc/actions/runs/8763696742/job/24052878678):
How can we spend 2 minutes for 0 Bytes of cache? |
@andig its 0 MB rounded from 325KB so not the 0B. |
Absolutely. But still 2 minutes- more than writing that amount to a floppy disk 💾 |
This issue contains mixed problems. The original issue was with The other discussions are related to the cache of the action: the problem was related to Go modules cache. Since Now, the |
@ldez given that I had already excluded Go modules cache and given that restoring the remaining cache seems unreasonably slow, would you a agree that it's a likely assumption that this might be related to the cache action itself or probably more to the underlying Github/Azure infrastructure? |
For sure, the performances are related to the hardware used for the CI. Note: #297 (comment) you can remove |
In the documentation, it says the execution of golangci-lint could take 1s or 35s without cache, but in my project, I am getting a bigger time to execute the command.
For example, I had a run that took 110629ms, and it is a small project. In my machine normally took 4s (based on the output of the time command)
In the GitHub action I am using the same setup we have in the documentation
Job definition
Job output
Local machine output
time golangci-lint run --out-format=github-actions --timeout 3m0s golangci-lint run --out-format=github-actions --timeout 3m0s 4.34s user 5.27s system 399% cpu 2.404 total
The text was updated successfully, but these errors were encountered: