Compare commits

..
3 Commits
Author SHA1 Message Date
MSP-Greg 271876da60 Allow running external function before 'bundle install'
External actions may use setup-ruby, and some actions make changes/additions to the build environment. These may be needed for dependencies.

Hence, allow those external actions to run code before 'bundle install'. This is done by passing a function as a parameter to setupRuby().
2020-07-01 21:22:43 +02:00
Benoit Daloze 5c4fc21c57 Add JRuby 9.2.12.0 2020-07-01 21:16:36 +02:00
Benoit Daloze c8a88df157 Refactor how to call setup-ruby from other actions
* Automatically use inputs if available, use defaults otherwise.
2020-06-14 16:51:29 +02:00
3 changed files with 36 additions and 16 deletions
Generated Vendored
+18 -8
View File
@@ -2199,20 +2199,23 @@ const inputDefaults = {
'working-directory': '.',
}
// entry point when this action is run on its own
async function run() {
try {
const options = {}
for (const key in inputDefaults) {
options[key] = core.getInput(key)
}
await setupRuby(options)
await setupRuby()
} catch (error) {
core.setFailed(error.message)
}
}
async function setupRuby(options) {
const inputs = { ...inputDefaults, ...options }
// entry point when this action is run from other actions
async function setupRuby(options = {}) {
const inputs = { ...options }
for (const key in inputDefaults) {
if (!inputs.hasOwnProperty(key)) {
inputs[key] = core.getInput(key) || inputDefaults[key]
}
}
process.chdir(inputs['working-directory'])
@@ -2235,6 +2238,13 @@ async function setupRuby(options) {
setupPath(newPathEntries)
// When setup-ruby is used by other actions, this allows code in them to run
// before 'bundle install'. Installed dependencies may require additional
// libraries & headers, build tools, etc.
if (inputs['afterSetupPathHook'] instanceof Function) {
await inputs['afterSetupPathHook']({ platform, rubyPrefix, engine, version })
}
if (inputs['bundler'] !== 'none') {
await common.measure('Installing Bundler', async () =>
installBundler(inputs['bundler'], platform, rubyPrefix, engine, version))
@@ -3083,7 +3093,7 @@ function getVersions(platform) {
],
"jruby": [
"9.1.17.0",
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1",
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0",
"head"
],
"truffleruby": [
+17 -7
View File
@@ -13,20 +13,23 @@ const inputDefaults = {
'working-directory': '.',
}
// entry point when this action is run on its own
export async function run() {
try {
const options = {}
for (const key in inputDefaults) {
options[key] = core.getInput(key)
}
await setupRuby(options)
await setupRuby()
} catch (error) {
core.setFailed(error.message)
}
}
export async function setupRuby(options) {
const inputs = { ...inputDefaults, ...options }
// entry point when this action is run from other actions
export async function setupRuby(options = {}) {
const inputs = { ...options }
for (const key in inputDefaults) {
if (!inputs.hasOwnProperty(key)) {
inputs[key] = core.getInput(key) || inputDefaults[key]
}
}
process.chdir(inputs['working-directory'])
@@ -49,6 +52,13 @@ export async function setupRuby(options) {
setupPath(newPathEntries)
// When setup-ruby is used by other actions, this allows code in them to run
// before 'bundle install'. Installed dependencies may require additional
// libraries & headers, build tools, etc.
if (inputs['afterSetupPathHook'] instanceof Function) {
await inputs['afterSetupPathHook']({ platform, rubyPrefix, engine, version })
}
if (inputs['bundler'] !== 'none') {
await common.measure('Installing Bundler', async () =>
installBundler(inputs['bundler'], platform, rubyPrefix, engine, version))
+1 -1
View File
@@ -11,7 +11,7 @@ export function getVersions(platform) {
],
"jruby": [
"9.1.17.0",
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1",
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0",
"head"
],
"truffleruby": [