qwen-code/scripts/tests/sdk-java-workflow.test.js
易良 fddcda86ed
ci: reduce SDK Java runner queueing (#8441)
* ci: cancel stale SDK Java pull request runs

* fix(ci): preserve SDK Java push scheduling

* ci: route trusted SDK Java jobs to ECS

* ci: simplify SDK Java runner routing

* fix(ci): provision Maven on ECS Java jobs

* fix(ci): clean SDK daemon ECS test state

* fix(ci): satisfy SDK Java lint
2026-08-03 16:21:05 +00:00

27 lines
1.1 KiB
JavaScript

import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const workflow = readFileSync('.github/workflows/sdk-java.yml', 'utf8');
const job = (name) => {
const start = workflow.indexOf(` ${name}:`);
const next = workflow.slice(start + 1).search(/\n {2}[a-z0-9-]+:\n/);
return workflow.slice(start, next < 0 ? undefined : start + 1 + next);
};
describe('SDK Java self-hosted workflow guards', () => {
it.each(['test', 'daemon-e2e'])('protects the %s job', (name) => {
const block = job(name);
for (const fragment of [
"github.repository == ''QwenLM/qwen-code''",
'github.event.pull_request.head.repo.full_name == github.repository',
"vars.MAINTAINER_ECS_RUNNER_DISABLED != ''true''",
'fromJSON(\'\'["self-hosted", "linux", "x64", "ecs-qwen"]\'\')',
"format('refs/pull/{0}/head', github.event.pull_request.number)",
"EXPECTED_SHA: '${{ github.event.pull_request.head.sha }}'",
'git merge-base --is-ancestor "${EXPECTED_SHA}" HEAD',
'exit 1',
]) {
expect(block).toContain(fragment);
}
});
});