MCPcopy Create free account
hub / github.com/cypress-io/github-action / installMaybe

Function installMaybe

index.js:986–1026  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

984}
985
986const installMaybe = () => {
987 const installParameter = getInputBool('install', true)
988 if (!installParameter) {
989 console.log('Skipping install because install parameter is false')
990 return Promise.resolve()
991 }
992
993 const packageManagerCacheEnabled = getInputBool(
994 'package-manager-cache',
995 true
996 )
997 const npmCachePromise = packageManagerCacheEnabled
998 ? restoreCachedNpm()
999 : Promise.resolve(false)
1000
1001 return Promise.all([
1002 npmCachePromise,
1003 restoreCachedCypressBinary()
1004 ]).then(([npmCacheHit, cypressCacheHit]) => {
1005 debug(`npm cache hit ${npmCacheHit}`)
1006 debug(`cypress cache hit ${cypressCacheHit}`)
1007
1008 return install().then(() => {
1009 debug('install has finished')
1010 return listCypressBinaries().then(() => {
1011 if (npmCacheHit && cypressCacheHit) {
1012 debug('no need to verify Cypress binary or save caches')
1013 return Promise.resolve(undefined)
1014 }
1015
1016 debug('verifying Cypress binary')
1017 const saveNpmPromise = packageManagerCacheEnabled
1018 ? saveCachedNpm()
1019 : Promise.resolve(undefined)
1020 return verifyCypressBinary()
1021 .then(() => saveNpmPromise)
1022 .then(saveCachedCypressBinary)
1023 })
1024 })
1025 })
1026}
1027
1028installMaybe()
1029 .then(buildAppMaybe)

Callers 1

index.jsFile · 0.85

Calls 7

getInputBoolFunction · 0.85
restoreCachedNpmFunction · 0.85
installFunction · 0.85
listCypressBinariesFunction · 0.85
saveCachedNpmFunction · 0.85
verifyCypressBinaryFunction · 0.85

Tested by

no test coverage detected