ci: rebuild the benchmark native addon when the restored one does not load

node-24-build can run on the self-hosted pool while the benchmarks stay on
hosted Linux; the phase jobs now load the restored Node-API addon and rebuild
it on their runner if it fails. The report spec cleans its directories with
onTestFinished, which also removes a clone the duplication gate reported.
This commit is contained in:
imccyu committed 2026-11-20 15:46:59 +08:00
1 parent 0394e32ce6
commit c0a05ff31e
3 files changed
+23 -8

No files matched your search

+14
View File
@@ -490,6 +490,20 @@ jobs:
zstd -dc -T0 "$archive" | tar -xmf -
test -f apps/cli/lib/bin.js && test -f apps/web/dist/index.html && test -f .dsh-build/client-build-environment.json
# node-24-build can run on another pool (vm-backup under self-hosted
# failover) while the benchmarks stay on hosted Linux, so the restored
# Node-API addon is loaded here and rebuilt on this runner if it fails.
- name: Rebuild the native addon if the restored one does not load
run: |
addon=native/system/packages/linux-x64/bin/glibc/system.node
if node -e 'process.dlopen({ exports: {} }, process.argv[1])' "$addon"; then
echo "Restored native addon loads on this runner."
else
echo "::notice::Restored native addon does not load on this runner; rebuilding it."
pnpm run build:native-system
node -e 'process.dlopen({ exports: {} }, process.argv[1])' "$addon"
fi
- name: Install benchmark browser and hosted dependencies
run: pnpm --filter @deepseek-ai/dsh-benchmarks exec playwright install --with-deps chromium
+6 -1
View File
@@ -866,7 +866,12 @@ describe('CI workflow', () => {
expect(steps[index('Download build output')]).toMatchObject({ uses: 'actions/download-artifact@v8.0.1', with: { name: 'build-output' } })
expect(index('Download build output')).toBeGreaterThan(index('Install (immutable)'))
expect(index('Unpack build output')).toBeGreaterThan(index('Download build output'))
expect(index('Run performance benchmarks')).toBeGreaterThan(index('Unpack build output'))
// A restored addon from another runner pool that does not load is rebuilt here.
const addon = index('Rebuild the native addon if the restored one does not load')
expect(addon).toBeGreaterThan(index('Unpack build output'))
expect(index('Run performance benchmarks')).toBeGreaterThan(addon)
expect(String(steps[addon]?.run)).toContain('process.dlopen({ exports: {} }, process.argv[1])')
expect(String(steps[addon]?.run)).toContain('pnpm run build:native-system')
expect(String(steps[index('Unpack build output')]?.run)).toContain('tar -xmf -')
})
+3 -7
View File
@@ -1,17 +1,13 @@
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it } from 'vitest'
import { describe, expect, it, onTestFinished } from 'vitest'
import { mergeReportDirectories, renderMergedReport } from '../benchmarks/support/scaling-report.ts'
const roots: string[] = []
afterEach(async () => {
for (const root of roots.splice(0)) await rm(root, { recursive: true, force: true })
})
/** A private directory removed when the current test finishes. */
async function temporaryRoot(): Promise<string> {
const root = await mkdtemp(join(tmpdir(), 'dsh-benchmark-report-'))
roots.push(root)
onTestFinished(() => rm(root, { recursive: true, force: true }))
return root
}