Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bundler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fs = require('fs')
const os = require('os')
const path = require('path')
const core = require('@actions/core')
const exec = require('@actions/exec')
Expand Down Expand Up @@ -193,8 +194,10 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
console.log(`Found cache for key: ${cachedKey}`)
}

// Number of jobs should scale with runner, up to a point
const jobs = Math.min(os.cpus().length, 8)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be os.availableParallelism() maybe? I found https://stackoverflow.com/a/77532237/388803
Also os.cpus().length doesn't seem to work on Windows, see CI results

Copy link
Member

@eregon eregon Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should from the https://nodejs.org/api/os.html#oscpus docs, I pushed a commit to try os.availableParallelism()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh, that doesn't seem to work on Windows either :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah the error probably means it needs to be a string and not a number for CLI arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I should know by now that Windows is particular about objects and types. I've been working mostly on Mac and Linux, and I figured the tests runners would catch any issues anyway, but this is good to know.

// Always run 'bundle install' to list the gems
await exec.exec('bundle', ['install', '--jobs', '4'])
await exec.exec('bundle', ['install', '--jobs', jobs])

// @actions/cache only allows to save for non-existing keys
if (!common.isExactCacheKeyMatch(key, cachedKey)) {
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.