-
Notifications
You must be signed in to change notification settings - Fork 81
Description
I did some study on the Github Actions, yesterday.
My learnings:
Freeing disk space is not "free"
It takes:
| path | min | max |
|---|---|---|
/usr/share/dotnet |
6s | 23s |
/usr/local/lib/android |
39s | 2m55s |
/opt/hostedtoolcache/CodeQL |
4s | 20s |
This feels strange, of course, but maybe Azure/GitHub uses some kind of layering file system (similar to docker's), and the thousands of files need to be layered off, instead of just wiped. We wouldn't know.
If it was <10s, cleaning disk space would be a good idea. Now, I think it's not.
Other options: Caching
In .github/workflows/ci.yaml both the steps (build and binary-size) use the same caching (1 and 2). I don't think this is needed, or a good idea.
buildcauses a cache of 2.3GB (fresh run, no passed-on caches)binary-sizecauses a cache of only 230MB
Most importantly, I think they cache partly different things. I would separate them. (though keep binary-size defaulting to the build cache if only that is available - it's a small trick to hyper-optimize this. Which is cool. Just cool.)
Sequential
@lulf mentioned earlier that it would be welcome to do the cargo fmt / clippy tests early, to fail fast. I wonder if there's a reason why the two jobs are currently being run in parallel. I would make the sequential - which can be done by adding a single line:
binary-size:
needs: build # run only if 'build' succeeds
This might mean slightly longer overall CI times, but I think it's a meaningful use of resources to first see things "look fine", then do the heavier work (binary-size being rather heavy at 3m).
In fact (π‘) - would you be open to separating the fmt/clippy parts to a preceding, third step, then depending both the "build" and the "binary-size" from that. I think this could be sweet: minor change to existing CI setup but guarantees fast fail on misformatted stuff.
Next steps
I can probably pull down the CI times to around 6 min - from current >10 min.
To see more of my experiment, see here: https://github.com/finalyards/trouble.fork/blob/ci-study/.github/workflows/ci.yaml