Speed up installation of prerequisites? #26882
-
Many actions require steps like installing Typically these prerequisites don’t change very often yet the time must be spent installing them over and over each time the repo contents frequently change. Are there techniques to help mitigate this? For example, jobs execute in parallel so if there was a way to tie Job 1 (“prereqs”) as a dependency of Step 6 of job 2 (but not job 2 as a whole), then steps 1-5 of job 2 could start executing along with job 1 and job 1 would likely complete before step 6 of job 2 was reached. If not, step 6 of job 2 would wait until job 1 completes. AFAIK this isn’t possible today? - I’d have to execute things sequentially in the same job or have job 2 depend on job 1 (same result?) or take a chance that job 1 may not be done before some part of it is needed in job 2. Or if there was some way to have a pool of agents with steps from a job that can be cached in some way so they are not executed each time? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
I’m pretty sure you can cache them. I’ll see if I can dig up some info. |
Beta Was this translation helpful? Give feedback.
-
You want to use the cache action. Here’s an example using it to cache ruby gems (but it’s generic and can cache anything. The key thing is to use a hashkey that makes sense so the cache is invalidated when the things you are caching change. In this case below, I’m using a hash of the Gemfile.lock (which is the lock file for Ruby gems). When it changes, the cache is invalidated.
|
Beta Was this translation helpful? Give feedback.
-
@dnorth98 Thanks, will take a look at that. I’m not sure that would help for apt packages that may place files in varying locations with various dependencies but for tools or app package dependencies that I control the destination more that may be of use. |
Beta Was this translation helpful? Give feedback.
-
There’s: |
Beta Was this translation helpful? Give feedback.
-
A Docker image would be another possibility as long as Linux only is fine for your project. You can containerize an entire build environment including dependencies and it’s just a single, rather fast pull. It probably doesn’t beat a cache though. |
Beta Was this translation helpful? Give feedback.
There’s: