Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// executes the following all in parallel
const promise1 = exec.exec('sudo', ['apt-get', 'remove', 'mysql-client'])
const promise2 = exec.exec('wget', [pkgOption, `${mirrorUrl}/libmysqlclient18_5.5.62-0%2Bdeb8u1_amd64.deb`])
const promise3 = exec.exec('wget', [pkgOption, `${mirrorUrl}/libmysqlclient-dev_5.5.62-0%2Bdeb8u1_amd64.deb`])
const promise4 = exec.exec('wget', [pkgOption, `${ubuntuUrl}/g/glibc/multiarch-support_2.27-3ubuntu1.2_amd64.deb`])
// wait for the parallel processes to finish
await Promise.all([promise1, promise2, promise3, promise4])
// executes serially
await exec.exec('sudo', ['dpkg', '-i', `${pkgDir}/multiarch-support_2.27-3ubuntu1.2_amd64.deb`])
await exec.exec('sudo', ['dpkg', '-i', `${pkgDir}/libmysqlclient18_5.5.62-0+deb8u1_amd64.deb`])
await exec.exec('sudo', ['dpkg', '-i', `${pkgDir}/libmysqlclient-dev_5.5.62-0+deb8u1_amd64.deb`])
core.endGroup()
}
const openSslPath = rubyOpenSslPath(rubyVersion);
core.exportVariable('OPENSSL_DIR', openSslPath)
prependEnv('LDFLAGS', `-L${openSslPath}/lib`)
prependEnv('CPPFLAGS', `-I${openSslPath}/include`)
prependEnv('PKG_CONFIG_PATH', `${openSslPath}/lib/pkgconfig`, ':')
openSslOption = `--with-openssl-dir=${openSslPath}`
core.exportVariable('CONFIGURE_OPTS', openSslOption)
prependEnv('RUBY_CONFIGURE_OPTS', openSslOption)
// required for some versions of nokogiri
gemInstall('pkg-config', '~> 1.1.7')
core.endGroup()
}
async function installSystemDependencies() {
core.startGroup(`Installing system dependencies`)
const dependencyList = 'libyaml-dev libgdbm-dev libreadline-dev libncurses5-dev zlib1g-dev libffi-dev'
console.log(`installing system dependencies ${dependencyList}`)
await exec.exec('sudo apt-get update')
await exec.exec(`sudo apt-get install -y --no-install-recommends ${dependencyList}`)
core.endGroup()
}
public async call(config: configuration.Config, archive: string): Promise {
const postfix = Math.random().toString(36).substring(2, 15)
const reportPath = config.user.outputFile ? path.resolve(config.user.outputFile) : path.join(os.tmpdir(), `grcov-report-${postfix}`);
const args = this.buildArgs(config, archive, reportPath);
try {
core.startGroup('Execute grcov');
await exec.exec(this.path, args);
} catch (error) {
throw error;
} finally {
core.endGroup();
}
core.info(`Generated coverage report at ${reportPath}`);
return reportPath;
}
async function _installRubyBuild() {
core.startGroup('Installing ruby-build')
await _installDependencies()
const rubyBuildDir = `${process.env.HOME}/var/ruby-build`
await exec.exec(`git clone https://github.com/rbenv/ruby-build.git ${rubyBuildDir}`)
await exec.exec(`sudo ${rubyBuildDir}/install.sh`, { env: { 'PREFIX': '/usr/local' } })
core.endGroup()
}
async function _installRuby(rubyVersion, cacheAvailable) {
core.startGroup(`Installing ${rubyVersion}`)
if (!cacheAvailable) {
await exec.exec(`ruby-build ${rubyVersion} ${process.env.HOME}/local/rubies/${rubyVersion}`)
} else {
core.info(`Skipping installation of ${rubyVersion}, already available in cache.`)
}
core.addPath(`${process.env.HOME}/local/rubies/${rubyVersion}/bin`)
const rubyPath = await io.which('ruby', true)
await exec.exec(`${rubyPath} --version`)
core.setOutput('ruby-path', rubyPath);
core.endGroup()
}
async function showVersions() {
core.startGroup("Show Versions")
await exec.exec('ruby', ['--version'])
await exec.exec('ruby', ['-ropenssl', '-e', "puts OpenSSL::OPENSSL_LIBRARY_VERSION"])
await exec.exec('gem', ['--version'])
await exec.exec('bundle', ['--version'])
await exec.exec('openssl', ['version'])
core.endGroup()
}
async function restoreRubyFromCache(rubyVersion) {
core.startGroup(`Restore Ruby from Cache`)
const key = rubyCacheKey(rubyVersion)
await cache.restoreCache(rubyCachePaths(rubyVersion), key, [key])
core.endGroup()
}
async function buildRuby(rubyVersion) {
core.startGroup(`Build Ruby ${rubyVersion}`)
await exec.exec(`ruby-build --verbose ${rubyVersion} ${rubyPath(rubyVersion)}`)
core.endGroup()
}
'setlocal',
'IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=' + core.getInput('path-type'),
`%~dp0\\msys64\\usr\\bin\\bash.exe -ilc "cd $OLDPWD && %*"`
].join('\r\n'));
core.addPath(dest);
core.exportVariable('MSYSTEM', core.getInput('msystem'));
core.startGroup('Starting MSYS2 for the first time...');
await exec.exec(`msys2do`, (core.getInput('update') == 'true') ?
['pacman', '-Syu', '--noconfirm']
:
['uname', '-a']
);
core.endGroup();
}
catch (error) {
core.setFailed(error.message);
}
}