test(ci): [CI-01] cover installed Danmuku and native Mask combinations

This commit is contained in:
Harvey Zhao committed 2026-09-15 03:56:05 +08:00
1 parent 54169fdca1
commit 92b04d75c0
27 files changed
+8768 -72

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import assert from 'node:assert/strict'
import fs from 'node:fs'
import path from 'node:path'
import { hash } from '../../refactor/scripts/releases.mjs'
export function danmukuMaskAssets(root) {
const baseline = JSON.parse(fs.readFileSync(path.join(root, 'refactor/baselines/danmuku-mask-release.json'), 'utf8'))
return baseline.sdk.assets.map(({ file, sha256 }) => {
assert(file.startsWith('docs/assets/@mediapipe/selfie_segmentation/') && !file.split('/').includes('..'), 'Unexpected model asset path')
const absolute = path.join(root, file)
const bytes = fs.readFileSync(absolute)
const actual = hash(bytes)
// Checkout newline conversion is allowed only for metadata, never executed assets.
const normalizedLF = /\.(?:md|d\.ts|json)$/.test(file) && actual !== sha256
assert.equal(normalizedLF ? hash(bytes.toString().replaceAll('\r\n', '\n')) : actual, sha256, `Model asset differs from fixed source: ${file}`)
return { route: file.slice(4), bytes, source: { kind: 'local-model-resource', file: absolute, relativeFile: file, sha256: actual, baselineSha256: sha256, normalizedLF } }
})
}