Skip to content

Commit a96ff53

Browse files
thomasbrelanderegon
authored andcommitted
Scale bundler install jobs with CPU count up to 8
The number of jobs should scale with the runner CPU count, up to a point. The bottleneck becomes network / disk I/O at very large numbers, and 8 seems like a reasonable maximum based on my experience at this time.
1 parent 4ff6f36 commit a96ff53

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

‎bundler.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
constfs=require('fs')
2+
constos=require('os')
23
constpath=require('path')
34
constcore=require('@actions/core')
45
constexec=require('@actions/exec')
@@ -193,8 +194,10 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
193194
console.log(`Found cache for key: ${cachedKey}`)
194195
}
195196

197+
// Number of jobs should scale with runner, up to a point
198+
constjobs=Math.min(os.cpus().length,8)
196199
// Always run 'bundle install' to list the gems
197-
awaitexec.exec('bundle',['install','--jobs','4'])
200+
awaitexec.exec('bundle',['install','--jobs',jobs])
198201

199202
// @actions/cache only allows to save for non-existing keys
200203
if(!common.isExactCacheKeyMatch(key,cachedKey)){

‎dist/index.js‎

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)