mui / mui-toolpad

Toolpad Studio: Low-code admin builder. Open-source and powered by MUI.
https://mui.com/toolpad/
MIT License
880 stars 219 forks source link

Investigate CI jobs timing #1158

Open bytasv opened 1 year ago

bytasv commented 1 year ago

Duplicates

Latest version

Summary 💡

With a slowing growing CI running times we might want to look into what's taking how long and whether there are any small wins that we could capture.

Would be good to understand better how long what part of job takes, what are the options to reduce duration (if any), if we could maybe skip CI jobs when they are obviously not required (i.e. change of readme file or something similar that would not benefit in any way from testing or building)

Examples 🌈

No response

Motivation 🔦

No response

Janpot commented 1 year ago

With a slowing growing CI running times

Not that there could be no value in improving CI timings, but the data suggests differently. There has been a peak, but CI times are at a similar level to July. I'm not 100% sure what happened around beginning of september, I don't remember builds taking one hour. I do remember there to be a few circleci outages with delayed jobs, perhaps related?

Screenshot 2022-10-15 at 15 31 31

IMO, once CI passes the two minute mark, I can't really use it in a synchronous way anymore. From that point on, if I want to increase efficiency, I'll have to find ways to asynchronously work around CI. e.g.

That being said, it looks like the CI job taking most of the time is the docker one. And within that workflow, the docker build. I'm not sure there's any quick wins there, besides beefing up the machine. IMO, if we're going to start optimizing the docker build, I believe we should rather optimize for image size and not for build time as improving image size has direct user value.

Besides decreasing the monthly circleci bill. I personally don't feel like I would gain much from improving CI time with say 5 minutes (and neither would I lose much from it increasing 5 minutes).

As for render.com, after analyzing the build logs, I see it basically divided equally between dependency installation and next.js build (about 7, 8 minutes each). I find this rather on the long end for both of them and I wonder about caching. render.com does some build caching, but doesn't allow us the set custom cache folders (please upvote 🙂). The logs also suggest Next.js doesn't have its build cached. I don't see at the many opportunities for improvement.

bytasv commented 1 year ago

That sounds fair enough 👍 I'm just wondering if it would be worth to use GH action which could conditionally run certain jobs, i.e. if we change something that does not require build - skip build job, etc...?

Janpot commented 1 year ago

Dug a bit further and it looks like we can build caching ourselves in render.com. Trying that out in https://github.com/mui/mui-toolpad/pull/1166

I'm just wondering if it would be worth to use GH action which could conditionally run certain jobs, i.e. if we change something that does not require build - skip build job, etc...?

Maybe, only thing I could think of could perhaps be not building the docker image on PRs that only contain changes in the ./docs folder. (We don't need GH actions for this, circleci should be able to do this as well)

bytasv commented 1 year ago

Maybe, only thing I could think of could perhaps be not building the docker image on PRs that only contain changes in the ./docs folder. (We don't need GH actions for this, circleci should be able to do this as well)

That could be a start 🤔 we could also try to see if we are able to identify some other PR "types" that would not require CI run, I mean just a general observation over few weeks and then discuss with team whether it useful to run jobs for picked PRs or not 🤔

Janpot commented 1 year ago

I believe we should look into turborepo to help us with that.

edit: and we could look into pnpm to improve install times (and correctness)

apedroferreira commented 1 year ago

+1 for turborepo, if there are no changes in certain packages it would just use its cache so building would be instant.