free-programming-books icon indicating copy to clipboard operation
free-programming-books copied to clipboard

ci(check-urls): use a matrix to speed-up execution

Open davorpa opened this issue 3 years ago • 6 comments

What does this PR do?

Improve repo

For resources

Description

The matrix strategy creates 10 max-parallel workers with a disabled fail-fast parameter

Examples

  • Before: https://github.com/davorpa/free-programming-books/actions/runs/2999590952
  • After: https://github.com/davorpa/free-programming-books/actions/runs/3007199364

Running the workflow when -langs.md or -subject.md files are involved could exhaust the runner execution max-time like sometime happens in the past (https://github.com/EbookFoundation/free-programming-books/actions/runs/2924594027 max is 360min).

image

Using this implementation... the elapsed time is of the longest execution time, normally no more than 30min on the worst of cases.

Moreover, we can meter how much time awesome bot consumes in each check.

Checklist:

Follow-up

  • Check the status of GitHub Actions and resolve any reported warnings!

davorpa avatar Sep 07 '22 14:09 davorpa

there must be some limit on how many threads the repo can use as a whole. Worrying about load in October

eshellman avatar Sep 07 '22 14:09 eshellman

there must be some limit on how many threads the repo can use as a whole. Worrying about load in October

About max-parallel matrix strategy param:

The maximum number of jobs that can run simultaneously when using a matrix job strategy. By default, GitHub will maximize the number of jobs run in parallel depending on the available runners on GitHub-hosted virtual machines

Is it 10 well or better leave GitHub to decide?

Moreover... setting max-parallel: 1 it will the same what we have now :wink: but with a bit penalization of 5s (I'm not sure at all) wasting on warm up the job container.

davorpa avatar Sep 08 '22 05:09 davorpa

Investigating if needs / how to add

image https://github.com/davorpa/free-programming-books/blob/f9be34faa39faafe64bfb2c5c4b118bbfa8761c9/.github/workflows/check-urls.yml#L59-L67

a precheck when no files are changed. It could crash if spawned jobs are 0. It could be related with #7059 but addressing concurrency

davorpa avatar Sep 08 '22 08:09 davorpa

Investigating if needs / how to add

image davorpa/free-programming-books@f9be34f/.github/workflows/check-urls.yml#L59-L67

a precheck when no files are changed. It could crash if spawned jobs are 0. It could be related with #7059 but addressing concurrency

Fixed!!!

The workflows runs testing that:

  • Failing: https://github.com/davorpa/free-programming-books/actions/runs/3031689939
  • Working after apply 3e9a1e69778e91da5ceec71e649dba4be5bd194a: https://github.com/davorpa/free-programming-books/actions/runs/3031721462

davorpa avatar Sep 11 '22 12:09 davorpa

Reviewers welcome!

eshellman avatar Sep 12 '22 13:09 eshellman

Conflicts are with #7096. Preserve it side in concurrency config

davorpa avatar Sep 21 '22 14:09 davorpa

Oh no 😟! Conflicts have been found.

Please 🙏, take a moment and address the merge conflicts of your pull request before we can evaluate it again.

Thanks in advance for your effort and patience ❤️!

github-actions[bot] avatar Feb 23 '23 15:02 github-actions[bot]

This seems like it could be a really nice improvement. I like that you are not failing fast so a user can see all issues right away. In looking at the workflow results I am a bit confused though.

Original Workflow

image

Matrix workflow

image

As you can see, the new workflow shows a total time that is nearly 3 times as long as the original. With that said, the individual times add up to 30s so maybe this is misleading on GitHubs part. Additionally, this is only running a single test, so not really seeing the full benefits of the matrix.

As far as I can tell, this is, at the very least, working as expected. Would it be worth making some test PR's that trigger as many workflows as possible to get a better gauge what improvement to execution time this makes? Admittedly, I have not used this matrix feature before, so let me know if there is anything else I should look into/test on my end.

Thenlie avatar Feb 23 '23 17:02 Thenlie

is this ready?

eshellman avatar Feb 24 '23 14:02 eshellman

is this ready?

Yes, developing is ready 😉

davorpa avatar Feb 24 '23 15:02 davorpa