Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,22 @@ jobs:
if: "${{ needs.classify_pr.outputs.skip_ci != 'true' && runner.environment == 'self-hosted' }}"
uses: './.github/actions/configure-windows-runner'

# The runner profile directory is exposed through an 8.3 short alias
# (C:\Users\RUNNER~1), so %TEMP% yields short-name paths while
# fs.realpath resolves the long form of the same directory — tests that
# compare path strings then fail (~200 cases). Point TEMP/TMP at a
# sibling of the workspace after self-hosted tuning so this value wins,
# and before setup-node / npm install so every later step uses it.
- name: 'Point temp at a short-alias-free directory'
if: "${{ needs.classify_pr.outputs.skip_ci != 'true' }}"
shell: 'powershell'
run: |-
$temp = Join-Path $env:RUNNER_WORKSPACE 'qwen-code-temp'
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
Comment thread
yiliang114 marked this conversation as resolved.
Resolved
New-Item -ItemType Directory -Force -Path $temp | Out-Null
"TEMP=$temp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"TMP=$temp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Host "TEMP set to $temp"

# Same stale-checkout guard as the Ubuntu gate: this job now runs on ECS,
# so fail loud if the checkout lacks the merge-queue head rather than
# silently testing the wrong tree into a merge.
Expand Down Expand Up @@ -1059,6 +1075,11 @@ jobs:
if: "${{ needs.classify_pr.outputs.skip_ci != 'true' && runner.environment == 'self-hosted' }}"
uses: './.github/actions/self-hosted-node'

- name: 'Verify temp paths carry no short alias'
if: "${{ needs.classify_pr.outputs.skip_ci != 'true' }}"
run: |-
node -e "const fs=require('node:fs');for(const key of ['TEMP','TMP']){const value=process.env[key];const real=fs.realpathSync(value);if(real!==value){console.error(key+' carries a short alias: '+value+' -> '+real);process.exitCode=1}}"

- name: 'Configure persistent npm cache (self-hosted)'
if: "${{ needs.classify_pr.outputs.skip_ci != 'true' && runner.environment == 'self-hosted' }}"
run: |-
Expand Down
34 changes: 34 additions & 0 deletions scripts/tests/no-ak-integration-ci.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,23 @@ describe('no-AK integration CI wiring', () => {
expect(configure).toContain(
"uses: './.github/actions/configure-windows-runner'",
);
const redirectTemp = getWorkflowStep(
windowsJob,
'Point temp at a short-alias-free directory',
);
for (const key of ['TEMP', 'TMP']) {
expect(redirectTemp).toContain(
`"${key}=$temp" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append`,
);
}
const verifyTemp = getWorkflowStep(
windowsJob,
'Verify temp paths carry no short alias',
);
expect(verifyTemp).toContain("for(const key of ['TEMP','TMP'])");
expect(verifyTemp).toContain('fs.realpathSync(value)');
expect(verifyTemp).toContain('if(real!==value)');
expect(verifyTemp).toContain('process.exitCode=1');
const configureAction = readFileSync(
path.join(ROOT, CONFIGURE_ACTION_PATH),
'utf8',
Expand All @@ -406,13 +423,30 @@ describe('no-AK integration CI wiring', () => {
const configureUseIndex = windowsJob.indexOf(
"uses: './.github/actions/configure-windows-runner'",
);
const redirectTempIndex = windowsJob.indexOf(
"name: 'Point temp at a short-alias-free directory'",
);
const hostedNodeIndex = windowsJob.indexOf('actions/setup-node@');
const selfHostedNodeIndex = windowsJob.indexOf(
"uses: './.github/actions/self-hosted-node'",
);
const verifyTempIndex = windowsJob.indexOf(
"name: 'Verify temp paths carry no short alias'",
);
const installIndex = windowsJob.indexOf("name: 'Install dependencies'");
const guardUseIndex = windowsJob.indexOf(
"uses: './.github/actions/verify-checkout-head'",
);
expect(windowsCheckoutIndex).toBeGreaterThanOrEqual(0);
expect(autocrlfIndex).toBeGreaterThanOrEqual(0);
expect(autocrlfIndex).toBeLessThan(windowsCheckoutIndex);
expect(configureUseIndex).toBeGreaterThan(windowsCheckoutIndex);
expect(redirectTempIndex).toBeGreaterThan(configureUseIndex);
expect(redirectTempIndex).toBeLessThan(hostedNodeIndex);
expect(redirectTempIndex).toBeLessThan(selfHostedNodeIndex);
expect(verifyTempIndex).toBeGreaterThan(hostedNodeIndex);
expect(verifyTempIndex).toBeGreaterThan(selfHostedNodeIndex);
expect(verifyTempIndex).toBeLessThan(installIndex);
expect(guardUseIndex).toBeGreaterThan(windowsCheckoutIndex);
expect(configureUseIndex).toBeLessThan(guardUseIndex);
for (const line of [
Expand Down
Loading