Counter ASIC 3.0: the identities job's ${appDir}: fix and the class guard tools/ci/ps-drive-ref-check.sh in CI (a $name: inside a double-quoted string is a PowerShell 5.1 parse error; backtick-escaped dollars ignored)
This commit is contained in:
parent
21de1d0a26
commit
15b315e503
3 changed files with 29 additions and 1 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -67,6 +67,8 @@ jobs:
|
|||
run: bash tools/ci/identity-check.sh
|
||||
- name: no conflict markers in tracked files
|
||||
run: bash tools/ci/no-conflict-markers.sh
|
||||
- name: PowerShell drive-reference check (a `$name:` inside a double-quoted string is a 5.1 parse error)
|
||||
run: bash tools/ci/ps-drive-ref-check.sh
|
||||
- name: copied sources are re-stamped before a build
|
||||
run: bash tools/ci/copied-sources-check.sh
|
||||
- name: override params files parse with no duplicate key (the duplicate-field class, 6 October 2026)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ $appDir = if ($env:IGNEUM_APP_DIR) { $env:IGNEUM_APP_DIR } else { Join-Path $env
|
|||
$urlFile = Join-Path $appDir 'app.url'
|
||||
$base = $null
|
||||
if (Test-Path $urlFile) { $base = (Get-Content -LiteralPath $urlFile -Raw).Trim().TrimEnd('/') }
|
||||
if (-not $base) { "RESULT identities error=no app.url under $appDir: nothing posted"; Summary 'failed' @{ reason = 'no app.url' }; exit 1 }
|
||||
if (-not $base) { "RESULT identities error=no app.url under ${appDir}: nothing posted"; Summary 'failed' @{ reason = 'no app.url' }; exit 1 }
|
||||
|
||||
$wantKey = 'amd:gfx1201'
|
||||
$wantIdent = 8
|
||||
|
|
|
|||
26
tools/ci/ps-drive-ref-check.sh
Executable file
26
tools/ci/ps-drive-ref-check.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
# The drive-reference class (6 October 2026): in Windows PowerShell 5.1 a double-quoted string holding `$name:` followed
|
||||
# by a character that is not a path separator is parsed as a drive-qualified variable (`$name:rest`), which is a parse
|
||||
# error at script start ("Variable reference is not valid"): the identities job run-ca3-pc1-amd-identities-20261006
|
||||
# failed in 0 s on `"... under $appDir: nothing posted"`. Rule: write `${name}:` or `$($name):`. This check fails CI on
|
||||
# any .ps1 whose double-quoted strings hold `$name:` where name is not a PowerShell scope or drive (env, script,
|
||||
# global, local, private, using, function, variable, alias, Env).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
python3 - <<'PY'
|
||||
import re, subprocess, sys
|
||||
files = subprocess.check_output(['git', 'ls-files', '*.ps1', '**/*.ps1'], text=True).split()
|
||||
ok_names = {'env', 'Env', 'ENV', 'script', 'global', 'local', 'private', 'using', 'function', 'variable', 'alias'}
|
||||
pat = re.compile(r'(?<!`)\$([A-Za-z_][A-Za-z0-9_]*):(?![\\/:])') # a backtick-escaped `$ is a literal dollar (here-strings that generate bash)
|
||||
fail = 0
|
||||
for f in sorted(set(files)):
|
||||
for n, line in enumerate(open(f, encoding='utf-8', errors='replace'), 1):
|
||||
if line.lstrip().startswith('#'): continue
|
||||
for seg in re.findall(r'"(?:[^"\\]|\\.|`")*"', line):
|
||||
for m in pat.finditer(seg):
|
||||
if m.group(1) in ok_names: continue
|
||||
print(f'ps-drive-ref: {f}:{n}: `${m.group(1)}:` inside a double-quoted string parses as a drive-qualified variable in PowerShell 5.1; write `${{{m.group(1)}}}:`')
|
||||
fail = 1
|
||||
if not fail: print(f'ps-drive-ref: {len(set(files))} .ps1 files, no `$name:` inside a double-quoted string')
|
||||
sys.exit(fail)
|
||||
PY
|
||||
Loading…
Reference in a new issue