build
This commit is contained in:
parent
8883487425
commit
ef78fd9c8a
7 changed files with 82000 additions and 5 deletions
29
dist/main/index.js
vendored
29
dist/main/index.js
vendored
|
|
@ -157,6 +157,11 @@ module.exports = {
|
||||||
name: 'repository',
|
name: 'repository',
|
||||||
paths: [bazelRepository]
|
paths: [bazelRepository]
|
||||||
},
|
},
|
||||||
|
remoteCacheServer: {
|
||||||
|
enabled: true,
|
||||||
|
url: 'http://localhost:8080/cache',
|
||||||
|
logPath: `${os.tmpdir()}/remote-cache-server.log`,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -96867,6 +96872,8 @@ const github = __nccwpck_require__(5438)
|
||||||
const glob = __nccwpck_require__(8090)
|
const glob = __nccwpck_require__(8090)
|
||||||
const tc = __nccwpck_require__(7784)
|
const tc = __nccwpck_require__(7784)
|
||||||
const config = __nccwpck_require__(5532)
|
const config = __nccwpck_require__(5532)
|
||||||
|
const { fork } = __nccwpck_require__(2081)
|
||||||
|
const path = __nccwpck_require__(1017)
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -96889,6 +96896,7 @@ async function setupBazel() {
|
||||||
await restoreCache(config.diskCache)
|
await restoreCache(config.diskCache)
|
||||||
await restoreCache(config.repositoryCache)
|
await restoreCache(config.repositoryCache)
|
||||||
await restoreExternalCaches(config.externalCache)
|
await restoreExternalCaches(config.externalCache)
|
||||||
|
await startRemoteCacheServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setupBazelisk() {
|
async function setupBazelisk() {
|
||||||
|
|
@ -96953,8 +96961,8 @@ async function downloadBazelisk() {
|
||||||
core.debug(`Downloading from ${url}`)
|
core.debug(`Downloading from ${url}`)
|
||||||
const downloadPath = await tc.downloadTool(url, undefined, `token ${token}`)
|
const downloadPath = await tc.downloadTool(url, undefined, `token ${token}`)
|
||||||
|
|
||||||
core.debug('Adding to the cache...');
|
core.debug('Adding to the cache...')
|
||||||
fs.chmodSync(downloadPath, '755');
|
fs.chmodSync(downloadPath, '755')
|
||||||
const cachePath = await tc.cacheFile(downloadPath, 'bazel', 'bazelisk', version)
|
const cachePath = await tc.cacheFile(downloadPath, 'bazel', 'bazelisk', version)
|
||||||
core.debug(`Successfully cached bazelisk to ${cachePath}`)
|
core.debug(`Successfully cached bazelisk to ${cachePath}`)
|
||||||
|
|
||||||
|
|
@ -96968,6 +96976,7 @@ async function setupBazelrc() {
|
||||||
`startup --output_base=${config.paths.bazelOutputBase}\n`
|
`startup --output_base=${config.paths.bazelOutputBase}\n`
|
||||||
)
|
)
|
||||||
fs.appendFileSync(bazelrcPath, config.bazelrc.join("\n"))
|
fs.appendFileSync(bazelrcPath, config.bazelrc.join("\n"))
|
||||||
|
fs.appendFileSync(bazelrcPath, `build --remote_cache=${config.remoteCacheServer.url}\n`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97035,7 +97044,21 @@ async function restoreCache(cacheConfig) {
|
||||||
}())
|
}())
|
||||||
}
|
}
|
||||||
|
|
||||||
run()
|
async function startRemoteCacheServer() {
|
||||||
|
core.startGroup("Remote cache server")
|
||||||
|
|
||||||
|
core.debug(`Remote cache server log file path: ${config.remoteCacheServer.logPath}`)
|
||||||
|
const log = fs.openSync(config.remoteCacheServer.logPath, 'a')
|
||||||
|
const serverProcess = fork(path.join(__dirname, 'dist', 'remote-cache-server', 'index.js'), [], {
|
||||||
|
detached: true,
|
||||||
|
stdio: ['ignore', log, log, 'ipc']
|
||||||
|
})
|
||||||
|
serverProcess.unref()
|
||||||
|
|
||||||
|
core.info(`Started remote cache server (${serverProcess.pid}`)
|
||||||
|
core.saveState('remote-cache-server-pid', serverProcess.pid.toString())
|
||||||
|
core.endGroup()
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
||||||
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
25
dist/post/index.js
vendored
25
dist/post/index.js
vendored
|
|
@ -157,6 +157,11 @@ module.exports = {
|
||||||
name: 'repository',
|
name: 'repository',
|
||||||
paths: [bazelRepository]
|
paths: [bazelRepository]
|
||||||
},
|
},
|
||||||
|
remoteCacheServer: {
|
||||||
|
enabled: true,
|
||||||
|
url: 'http://localhost:8080/cache',
|
||||||
|
logPath: `${os.tmpdir()}/remote-cache-server.log`,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -95935,11 +95940,31 @@ const core = __nccwpck_require__(2186)
|
||||||
const glob = __nccwpck_require__(8090)
|
const glob = __nccwpck_require__(8090)
|
||||||
const config = __nccwpck_require__(5532)
|
const config = __nccwpck_require__(5532)
|
||||||
const { getFolderSize } = __nccwpck_require__(4962)
|
const { getFolderSize } = __nccwpck_require__(4962)
|
||||||
|
const { execSync } = __nccwpck_require__(2081)
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
|
await stopRemoteCacheServer()
|
||||||
await saveCaches()
|
await saveCaches()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function stopRemoteCacheServer() {
|
||||||
|
const pid = core.getState('remote-cache-server-pid')
|
||||||
|
if (pid) {
|
||||||
|
try {
|
||||||
|
process.kill(pid, 'SIGTERM')
|
||||||
|
core.debug(`Stopped remote cache server with PID: ${pid}`)
|
||||||
|
} catch (error) {
|
||||||
|
core.error(`Failed to stop remote cache server with PID: ${pid}. Error: ${error}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const logPath = config.remoteCacheServer.logPath
|
||||||
|
if (fs.existsSync(logPath)) {
|
||||||
|
const logContent = fs.readFileSync(logPath, 'utf8')
|
||||||
|
core.debug(`Remote cache server log:\n${logContent}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function saveCaches() {
|
async function saveCaches() {
|
||||||
await saveCache(config.bazeliskCache)
|
await saveCache(config.bazeliskCache)
|
||||||
await saveCache(config.diskCache)
|
await saveCache(config.diskCache)
|
||||||
|
|
|
||||||
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
81945
dist/remote-cache-server/index.js
vendored
Normal file
81945
dist/remote-cache-server/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/remote-cache-server/index.js.map
vendored
Normal file
1
dist/remote-cache-server/index.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/remote-cache-server/sourcemap-register.js
vendored
Normal file
1
dist/remote-cache-server/sourcemap-register.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue