mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-08-06 23:35:34 +00:00
* ci: run Windows merge queue tests on ECS
* test(channels): skip POSIX mode assertion on Windows
* ci: expose Git Bash on Windows ECS runner
* ci: scope Windows ECS tuning to self-hosted and restore full test:ci
Review feedback on the Windows ECS routing: dropping test:scripts removed the only Windows execution of 9 Windows-only install-script tests, and the job-wide PowerShell default plus narrowed test command changed the kill-switch fallback away from the known-good hosted configuration.
Restore the full npm run test:ci on both paths (bash is available: pre-installed on hosted runners, exposed via the Git Bash PATH entry on ECS) and gate every ECS-specific adjustment on runner.environment: the PowerShell setup step (now also skip_ci-guarded), TEMP/TMP/LC_ALL env writes, and the Linux-style Node setup split that fails with an actionable error naming MAINTAINER_ECS_RUNNER_DISABLED. The windows-2022 fallback is byte-for-byte the pre-ECS job again.
* test: make Windows CI suites platform-aware
* ci: add stale-checkout guard to Windows ECS test job
* test(core): compare canonical directory identity
* ci: add fork guard and review follow-ups to Windows ECS job
* test(core): exercise real directory identity change
* test(core): wait for killed lease process exit
* test(scripts): avoid cmd echo trailing spaces
* test(scripts): use unambiguous cmd echo syntax
* test(cli): avoid sidecar I/O in truncation test
* test: fix Windows script-suite gaps and unify platform gating
- Fix missed trailing-space cmd stub in package-scripts.test.js so the
'runs prepare steps in order' assertion passes on Windows.
- Add qwen-pr-review-workflow.test.js and pr-self-report-label.test.js to
the win32 exclude list (both test Linux-only workflows and are not
portable to Windows).
- Replace local itPosix/describeOnNonWindows consts with vitest's built-in
it.skipIf/it.runIf/describe.skipIf, matching the codebase idiom.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
* test(scripts): restore Windows workflow coverage
* test(scripts): re-exclude Windows-incompatible workflow tests on win32
Re-add pr-self-report-label.test.js and qwen-pr-review-workflow.test.js to
the win32 exclude list. Both fail on a Windows runner for reasons the code
still carries: qwen-pr-review-workflow.test.js calls execFileSync('mkdir'),
which has no executable to resolve there, and pr-self-report-label.test.js
joins PATH with ':', corrupting the ';'-separated Windows PATH so its gh
stub never resolves. Excluding them restores a green Windows gate; Linux CI
remains their authoritative coverage. Document the criterion inline.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
* ci: extract checkout-head guard into composite action, pin Windows gate (#8386)
Address review round 2: move the stale-checkout guard shared by the four CI gates into .github/actions/verify-checkout-head so the copies cannot drift, pin the Windows gate kill-switch routing and guard wiring in the script tests, re-enable lint.test.js on Windows via separator normalization and a lazy linter setup in scripts/lint.js, unify the platform skips on it.skipIf(process.platform === 'win32'), and document the queued-run behavior of the ECS kill switch.
* ci: fail fast in Windows gate environment setup (#8386)
* ci: dedupe self-hosted runner steps into actions, pin gate mutations (#8386)
* fix(ci): checkout before repository-local actions in Windows gates (#8386)
* fix(ci): configure Windows runner before bash guard
* test(ci): pin remaining shared-action wiring in script tests (#8386)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
* fix(ci): skip zip-dependent packaging tests when zip is missing (#8386)
* fix(ci): validate full Windows smoke path
* fix(ci): match Windows smoke shell to gate and drop dead runs-on guard (#8386)
* fix(ci): make SIGTERM escalation test Windows-aware and tighten pins (#8386)
The CDP acceptance test asserted a POSIX-only SIGKILL escalation, which
fails deterministically on Windows where kill('SIGTERM') terminates the
child directly — blocking the Windows merge-queue gate. Assert the
platform-appropriate signal instead.
Also address review suggestions: probe `unzip` alongside `zip`, pin the
integration_cli guard's missing step-level `if:`, stop getWorkflowStep
at unnamed steps, pin install-script.test.js out of the win32 excludes,
add the stale-checkout guard to windows-runner-smoke.yml, pin the
Node preflight warning branch and the guard reject path contiguously,
and extend the smoke shell-parity loop to the npm cache step.
* docs(ci): clarify Windows runner trust boundary
---------
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
Co-authored-by: qwen-code-ci-bot <qwen-code-ci-bot@users.noreply.github.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: qwen-code-ci-bot <qwen-code-ci@service.alibaba.com>
246 lines
6.5 KiB
JavaScript
246 lines
6.5 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { execSync } from 'node:child_process';
|
|
import { createHash } from 'node:crypto';
|
|
import { mkdirSync, rmSync } from 'node:fs';
|
|
import { tmpdir } from 'node:os';
|
|
import { join } from 'node:path';
|
|
|
|
const ACTIONLINT_VERSION = '1.7.12';
|
|
const SHELLCHECK_VERSION = '0.11.0';
|
|
const YAMLLINT_VERSION = '1.35.1';
|
|
|
|
function sanitizePathPart(value) {
|
|
return value.replace(/[^A-Za-z0-9._-]/g, '_');
|
|
}
|
|
|
|
export function getLinterTempDir({
|
|
cwd = process.cwd(),
|
|
env = process.env,
|
|
} = {}) {
|
|
const baseDir = env.RUNNER_TEMP || tmpdir();
|
|
const runId = env.GITHUB_RUN_ID;
|
|
|
|
if (runId) {
|
|
return join(
|
|
baseDir,
|
|
'qwen-code-linters',
|
|
[
|
|
sanitizePathPart(runId),
|
|
sanitizePathPart(env.GITHUB_RUN_ATTEMPT || '1'),
|
|
sanitizePathPart(env.GITHUB_JOB || 'job'),
|
|
].join('-'),
|
|
);
|
|
}
|
|
|
|
const workspaceHash = createHash('sha256')
|
|
.update(cwd)
|
|
.digest('hex')
|
|
.slice(0, 16);
|
|
return join(baseDir, 'qwen-code-linters', `local-${workspaceHash}`);
|
|
}
|
|
|
|
const TEMP_DIR = getLinterTempDir();
|
|
|
|
function getPlatformArch() {
|
|
const platform = process.platform;
|
|
const arch = process.arch;
|
|
if (platform === 'linux' && arch === 'x64') {
|
|
return {
|
|
actionlint: 'linux_amd64',
|
|
shellcheck: 'linux.x86_64',
|
|
};
|
|
}
|
|
if (platform === 'darwin' && arch === 'x64') {
|
|
return {
|
|
actionlint: 'darwin_amd64',
|
|
shellcheck: 'darwin.x86_64',
|
|
};
|
|
}
|
|
if (platform === 'darwin' && arch === 'arm64') {
|
|
return {
|
|
actionlint: 'darwin_arm64',
|
|
shellcheck: 'darwin.aarch64',
|
|
};
|
|
}
|
|
throw new Error(`Unsupported platform/architecture: ${platform}/${arch}`);
|
|
}
|
|
|
|
/**
|
|
* @typedef {{
|
|
* check: string;
|
|
* installer: string;
|
|
* run: string;
|
|
* }}
|
|
*/
|
|
|
|
let lintersCache;
|
|
|
|
// Built lazily: getPlatformArch() throws on platforms where the POSIX-only
|
|
// linters cannot run (e.g. Windows test hosts importing getLinterTempDir).
|
|
/** @returns {{[linterName: string]: Linter}} */
|
|
function getLinters() {
|
|
if (!lintersCache) {
|
|
const platformArch = getPlatformArch();
|
|
lintersCache = {
|
|
actionlint: {
|
|
check: 'command -v actionlint',
|
|
installer: `
|
|
mkdir -p "${TEMP_DIR}/actionlint"
|
|
curl -sSLo "${TEMP_DIR}/.actionlint.tgz" "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_${platformArch.actionlint}.tar.gz"
|
|
tar -xzf "${TEMP_DIR}/.actionlint.tgz" -C "${TEMP_DIR}/actionlint"
|
|
`,
|
|
run: `
|
|
actionlint \
|
|
-color \
|
|
-pyflakes= \
|
|
-shellcheck= \
|
|
-ignore 'SC2002:' \
|
|
-ignore 'SC2016:' \
|
|
-ignore 'SC2129:' \
|
|
-ignore 'unexpected key "deployment" for "environment" section' \
|
|
-ignore 'label ".+" is unknown'
|
|
`,
|
|
},
|
|
shellcheck: {
|
|
check: 'command -v shellcheck',
|
|
installer: `
|
|
mkdir -p "${TEMP_DIR}/shellcheck"
|
|
curl -sSLo "${TEMP_DIR}/.shellcheck.txz" "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.${platformArch.shellcheck}.tar.xz"
|
|
tar -xf "${TEMP_DIR}/.shellcheck.txz" -C "${TEMP_DIR}/shellcheck" --strip-components=1
|
|
`,
|
|
run: `
|
|
git ls-files | grep -v '^integration-tests/terminal-bench/' | grep -E '^([^.]+|.*\\.(sh|zsh|bash))' | xargs file --mime-type \
|
|
| grep "text/x-shellscript" | awk '{ print substr($1, 1, length($1)-1) }' \
|
|
| xargs shellcheck \
|
|
--check-sourced \
|
|
--enable=all \
|
|
--exclude=SC2002,SC2129,SC2310 \
|
|
--severity=style \
|
|
--format=gcc \
|
|
--color=never | sed -e 's/note:/warning:/g' -e 's/style:/warning:/g'
|
|
`,
|
|
},
|
|
yamllint: {
|
|
check: 'command -v yamllint',
|
|
installer: `pip3 install --user "yamllint==${YAMLLINT_VERSION}"`,
|
|
run: "git ls-files | grep -E '\\.(yaml|yml)' | xargs yamllint --format github",
|
|
},
|
|
};
|
|
}
|
|
return lintersCache;
|
|
}
|
|
|
|
function runCommand(command, stdio = 'inherit') {
|
|
try {
|
|
const env = { ...process.env };
|
|
const nodeBin = join(process.cwd(), 'node_modules', '.bin');
|
|
env.PATH = `${nodeBin}:${TEMP_DIR}/actionlint:${TEMP_DIR}/shellcheck:${env.PATH}`;
|
|
if (process.platform === 'darwin') {
|
|
env.PATH = `${env.PATH}:${process.env.HOME}/Library/Python/3.12/bin`;
|
|
} else if (process.platform === 'linux') {
|
|
env.PATH = `${env.PATH}:${process.env.HOME}/.local/bin`;
|
|
}
|
|
execSync(command, { stdio, env });
|
|
return true;
|
|
} catch (_e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export function setupLinters() {
|
|
console.log('Setting up linters...');
|
|
rmSync(TEMP_DIR, { recursive: true, force: true });
|
|
mkdirSync(TEMP_DIR, { recursive: true });
|
|
|
|
const linters = getLinters();
|
|
for (const linter in linters) {
|
|
const { check, installer } = linters[linter];
|
|
if (!runCommand(check, 'ignore')) {
|
|
console.log(`Installing ${linter}...`);
|
|
if (!runCommand(installer)) {
|
|
console.error(
|
|
`Failed to install ${linter}. Please install it manually.`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
}
|
|
console.log('All required linters are available.');
|
|
}
|
|
|
|
export function runESLint() {
|
|
console.log('\nRunning ESLint...');
|
|
if (!runCommand('npm run lint:ci')) {
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
export function runActionlint() {
|
|
console.log('\nRunning actionlint...');
|
|
if (!runCommand(getLinters().actionlint.run)) {
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
export function runShellcheck() {
|
|
console.log('\nRunning shellcheck...');
|
|
if (!runCommand(getLinters().shellcheck.run)) {
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
export function runYamllint() {
|
|
console.log('\nRunning yamllint...');
|
|
if (!runCommand(getLinters().yamllint.run)) {
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
export function runPrettier() {
|
|
console.log('\nRunning Prettier...');
|
|
if (!runCommand('prettier --write .')) {
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
const args = process.argv.slice(2);
|
|
|
|
if (args.includes('--setup')) {
|
|
setupLinters();
|
|
}
|
|
if (args.includes('--eslint')) {
|
|
runESLint();
|
|
}
|
|
if (args.includes('--actionlint')) {
|
|
runActionlint();
|
|
}
|
|
if (args.includes('--shellcheck')) {
|
|
runShellcheck();
|
|
}
|
|
if (args.includes('--yamllint')) {
|
|
runYamllint();
|
|
}
|
|
if (args.includes('--prettier')) {
|
|
runPrettier();
|
|
}
|
|
|
|
if (args.length === 0) {
|
|
setupLinters();
|
|
runESLint();
|
|
runActionlint();
|
|
runShellcheck();
|
|
runYamllint();
|
|
runPrettier();
|
|
console.log('\nAll linting checks passed!');
|
|
}
|
|
}
|
|
|
|
main();
|