mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 09:07:40 +00:00
* ci: narrow native, launcher and packaging cache keys and stop PR-local saves * ci: hash Rust crate sources, not build outputs, in launcher and hook keys * ci: fail closed on unlocked native packages and cover transitive key inputs * ci: resolve the Windows Rust cache scope with a script, not a nested local action --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
#!/usr/bin/env node
|
|
// Prints `toolchain=` and `app-version=` cache-key outputs for the Windows Rust executables.
|
|
// rustc goes in restore-key prefixes because the exe reuse fingerprint does not cover it.
|
|
import { spawnSync } from 'node:child_process'
|
|
import { readFileSync } from 'node:fs'
|
|
import { join, resolve } from 'node:path'
|
|
|
|
function run(command, args) {
|
|
const result = spawnSync(command, args, {
|
|
encoding: 'utf8',
|
|
stdio: ['ignore', 'pipe', 'inherit']
|
|
})
|
|
if (result.error || result.status !== 0) {
|
|
throw new Error(
|
|
`${command} ${args.join(' ')} failed: ${result.error?.message ?? result.status}`
|
|
)
|
|
}
|
|
return result.stdout
|
|
}
|
|
|
|
const root = resolve(import.meta.dirname, '../..')
|
|
if (spawnSync('cargo', ['--version'], { stdio: 'ignore' }).status !== 0) {
|
|
run('rustup', ['toolchain', 'install', 'stable', '--profile', 'minimal'])
|
|
run('rustup', ['default', 'stable'])
|
|
}
|
|
const rustc = /^rustc (\S+)/.exec(run('rustc', ['--version']))?.[1]
|
|
const { version } = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'))
|
|
if (!rustc || !version) {
|
|
throw new Error('Missing rustc or package.json version')
|
|
}
|
|
console.log(`toolchain=rustc${rustc}`)
|
|
console.log(`app-version=${version}`)
|