Set up dependencies.

This commit is contained in:
Fabio Niephaus 2022-01-03 08:54:37 +01:00
parent a1ee297bf2
commit c26d35376d
No known key found for this signature in database
GPG Key ID: F21CF5275F31DFD6
2 changed files with 35 additions and 0 deletions

33
src/dependencies.ts Normal file
View File

@ -0,0 +1,33 @@
import * as core from '@actions/core'
import {GRAALVM_PLATFORM} from './constants'
import {exec} from '@actions/exec'
const APT_GET_INSTALL_BASE = 'sudo apt-get -y --no-upgrade install'
const COMPONENT_TO_DEPS = new Map<string, Map<string, string>>([
[
'linux',
new Map<string, string>([
['nodejs', `${APT_GET_INSTALL_BASE} g++ make`],
['ruby', `${APT_GET_INSTALL_BASE} make gcc libssl-dev libz-dev`],
[
'R',
`${APT_GET_INSTALL_BASE} libgomp1 build-essential gfortran libxml2 libc++-dev`
]
])
],
['darwin', new Map<string, string>([['ruby', 'brew install openssl']])]
])
export async function setUpDependencies(components: string[]): Promise<void> {
const platformDeps = COMPONENT_TO_DEPS.get(GRAALVM_PLATFORM)
if (platformDeps) {
for (const component of components) {
const depCommand = platformDeps.get(component)
if (depCommand) {
core.startGroup(`Installing dependencies for ${component}...`)
await exec(depCommand)
core.endGroup()
}
}
}
}

View File

@ -3,6 +3,7 @@ import * as core from '@actions/core'
import * as graalvm from './graalvm' import * as graalvm from './graalvm'
import {join} from 'path' import {join} from 'path'
import {mkdirP} from '@actions/io' import {mkdirP} from '@actions/io'
import {setUpDependencies} from './dependencies'
import {setUpGraalVMTrunk} from './graalvm-trunk' import {setUpGraalVMTrunk} from './graalvm-trunk'
import {setUpWindowsEnvironment} from './msvc' import {setUpWindowsEnvironment} from './msvc'
@ -18,6 +19,7 @@ async function run(): Promise<void> {
if (c.IS_WINDOWS) { if (c.IS_WINDOWS) {
setUpWindowsEnvironment() setUpWindowsEnvironment()
} }
setUpDependencies(components)
await mkdirP(c.GRAALVM_BASE) await mkdirP(c.GRAALVM_BASE)