feat: 회의 파일 가져오기와 입력 엔진 배포 보완
This commit is contained in:
parent
5a8c5cd792
commit
b3519e5da7
54 changed files with 1129 additions and 116 deletions
63
scripts/ci/lib/release-artifacts.test.mjs
Normal file
63
scripts/ci/lib/release-artifacts.test.mjs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
import assert from 'node:assert/strict'
|
||||
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import test from 'node:test'
|
||||
import { saveReleaseArtifacts, verifyReleaseArtifacts } from './release-artifacts.mjs'
|
||||
|
||||
const identity = { version: '1.16.0', tagCommit: 'a'.repeat(40), withRuntime: false }
|
||||
async function fixture(t) {
|
||||
const dir = await mkdtemp(join(tmpdir(), 'd3ro-release-checkpoint-'))
|
||||
t.after(() => rm(dir, { recursive: true, force: true }))
|
||||
for (const name of ['D3RO-Voice-Setup-1.16.0.exe', 'D3RO-Voice-Setup-1.16.0.exe.blockmap', 'latest.yml']) {
|
||||
await writeFile(join(dir, name), `original ${name}`)
|
||||
}
|
||||
await saveReleaseArtifacts(dir, identity)
|
||||
return dir
|
||||
}
|
||||
|
||||
test('reuses exact release bytes after a partial publication', async (t) => {
|
||||
const dir = await fixture(t)
|
||||
const verified = await verifyReleaseArtifacts(dir, identity)
|
||||
assert.equal(verified.artifacts.length, 3)
|
||||
})
|
||||
|
||||
test('rejects rebuilt bytes even when size is unchanged', async (t) => {
|
||||
const dir = await fixture(t)
|
||||
const path = join(dir, 'D3RO-Voice-Setup-1.16.0.exe')
|
||||
const original = await readFile(path, 'utf8')
|
||||
await writeFile(path, original.replace('original', 'modified'))
|
||||
await assert.rejects(verifyReleaseArtifacts(dir, identity), /artifact changed/)
|
||||
})
|
||||
|
||||
test('rejects missing artifacts and a different source commit', async (t) => {
|
||||
const dir = await fixture(t)
|
||||
await assert.rejects(verifyReleaseArtifacts(dir, { ...identity, tagCommit: 'b'.repeat(40) }), /tagCommit mismatch/)
|
||||
await assert.rejects(verifyReleaseArtifacts(dir, { ...identity, withRuntime: true }), /withRuntime mismatch/)
|
||||
await rm(join(dir, 'latest.yml'))
|
||||
await assert.rejects(verifyReleaseArtifacts(dir, identity), /ENOENT/)
|
||||
})
|
||||
|
||||
test('rejects paths outside the preserved release directory', async (t) => {
|
||||
const dir = await fixture(t)
|
||||
const path = join(dir, 'release-artifacts.json')
|
||||
const checkpoint = JSON.parse(await readFile(path, 'utf8'))
|
||||
checkpoint.artifacts[0].name = '../outside.exe'
|
||||
await writeFile(path, JSON.stringify(checkpoint))
|
||||
await assert.rejects(verifyReleaseArtifacts(dir, identity), /Invalid release artifact path/)
|
||||
})
|
||||
|
||||
test('preserves runtime and portable parts and rejects missing runtime bytes', async (t) => {
|
||||
const dir = await fixture(t)
|
||||
await mkdir(join(dir, 'runtime'))
|
||||
await writeFile(join(dir, 'portable.json'), JSON.stringify({ version: identity.version, volumes: [{ name: 'portable.7z.001' }], zipParts: [{ name: 'portable.zip.001' }] }))
|
||||
await writeFile(join(dir, 'runtime/runtime.json'), JSON.stringify({ version: identity.version, components: { sidecar: { parts: [{ name: 'sidecar.tar.gz.001' }] } } }))
|
||||
for (const name of ['portable.7z.001', 'portable.zip.001', 'd3ro-voice.scoop.json', 'runtime/sidecar.tar.gz.001']) {
|
||||
await writeFile(join(dir, name), name)
|
||||
}
|
||||
const expected = { ...identity, withRuntime: true }
|
||||
await saveReleaseArtifacts(dir, expected)
|
||||
assert.equal((await verifyReleaseArtifacts(dir, expected)).artifacts.length, 9)
|
||||
await rm(join(dir, 'runtime/sidecar.tar.gz.001'))
|
||||
await assert.rejects(verifyReleaseArtifacts(dir, expected), /ENOENT/)
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue