Integrate remote cache server for Bazel
This commit is contained in:
parent
363eb36ada
commit
b5e7d0a8af
5 changed files with 92 additions and 4 deletions
20
post.js
20
post.js
|
|
@ -5,11 +5,31 @@ const core = require('@actions/core')
|
|||
const glob = require('@actions/glob')
|
||||
const config = require('./config')
|
||||
const { getFolderSize } = require('./util')
|
||||
const { execSync } = require('child_process')
|
||||
|
||||
async function run() {
|
||||
await stopRemoteCacheServer()
|
||||
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() {
|
||||
await saveCache(config.bazeliskCache)
|
||||
await saveCache(config.diskCache)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue