CI:修正 workflow 的 shell 为 powershell(pwsh 不存在)
首次 CI 运行(run#1)两个 job 均失败于同一处: Cannot find: pwsh in PATH 根因:workflow 用 shell: pwsh(PowerShell 7,非 Windows 自带), 而 runner 所在机器只有 Windows PowerShell 5.1。 改为 shell: powershell(7 处)。已核验脚本无 PS7 独有语法 (无 ?? / ?: / && / || / -Parallel),PS 5.1 完全兼容。 workflow 头部补该坑说明,防止将来误改回 pwsh。 注:本次 CI 已验证 actions/checkout@v4 可从本实例正常拉取并 成功检出 v2-on-ui,action 拉取链路无需调整。
This commit is contained in:
+15
-7
@@ -16,6 +16,14 @@
|
||||
#
|
||||
# 触发:push(除纯文档路径外)与 pull_request。
|
||||
#
|
||||
# 🔴 shell 用 `powershell` 而非 `pwsh`(2026-10-02 实测修正):
|
||||
# `pwsh` = PowerShell 7,**不是 Windows 自带**;本机 runner 只有
|
||||
# Windows PowerShell 5.1(`C:\Windows\System32\WindowsPowerShell\v1.0\`),
|
||||
# 用 `shell: pwsh` 会直接报 `Cannot find: pwsh in PATH` → job 失败(跑不到任何业务逻辑)。
|
||||
# `shell: powershell` 在任意 Windows 上都存在,且本 workflow 的脚本
|
||||
# **刻意只用 PS 5.1 兼容语法**(无 `??`/`?:`/`&&`/`||`/`-Parallel`)。
|
||||
# ⚠️ 若将来要改回 `pwsh`,须先在所有 runner 上装 PowerShell 7。
|
||||
#
|
||||
# ⚠️ 前置(部署到 Gitea 时需确认):
|
||||
# - 该 Gitea 实例已启用 Actions:`[actions] ENABLED = true`(site admin 配置)
|
||||
# - 已注册一个 **Windows** runner(labels 含 `windows`),且装有:
|
||||
@@ -60,7 +68,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 环境自检(Python / cppcheck / pre-commit)
|
||||
shell: pwsh
|
||||
shell: powershell
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$missing = @()
|
||||
@@ -88,12 +96,12 @@ jobs:
|
||||
Write-Host "runner 环境自检通过"
|
||||
|
||||
- name: 安装 pre-commit 钩子到本仓库
|
||||
shell: pwsh
|
||||
shell: powershell
|
||||
run: python -m pre_commit install --install-hooks
|
||||
|
||||
- name: 决定跳过哪些钩子(Keil 依赖)
|
||||
id: skip
|
||||
shell: pwsh
|
||||
shell: powershell
|
||||
run: |
|
||||
# mem-numbers 的事实源是 Keil 构建产物 .map(已 gitignore)。
|
||||
# 无 .map => 本 runner 不可能跑 L0 的该钩子 => 跳过(不是"通过",是"不适用")。
|
||||
@@ -107,7 +115,7 @@ jobs:
|
||||
}
|
||||
|
||||
- name: 运行 L0 门禁(--all-files)
|
||||
shell: pwsh
|
||||
shell: powershell
|
||||
env:
|
||||
SKIP: ${{ steps.skip.outputs.value }}
|
||||
run: |
|
||||
@@ -129,7 +137,7 @@ jobs:
|
||||
|
||||
- name: 探测 MSVC(VS BuildTools / Community 等)
|
||||
id: msvc
|
||||
shell: pwsh
|
||||
shell: powershell
|
||||
run: |
|
||||
# 与 test/host/common/unit_test_harness.py 的 VS_ROOTS 保持一致
|
||||
$roots = @(
|
||||
@@ -155,7 +163,7 @@ jobs:
|
||||
|
||||
- name: 运行主机侧单测
|
||||
if: steps.msvc.outputs.value == 'yes'
|
||||
shell: pwsh
|
||||
shell: powershell
|
||||
run: |
|
||||
# 遍历 test/host/*/run_unit_test.py(各模块自带运行器,统一走 common harness)
|
||||
$runners = Get-ChildItem -Path 'test/host' -Recurse -Filter 'run_unit_test.py' |
|
||||
@@ -179,7 +187,7 @@ jobs:
|
||||
|
||||
- name: L0.5 跳过说明
|
||||
if: steps.msvc.outputs.value == 'no'
|
||||
shell: pwsh
|
||||
shell: powershell
|
||||
run: |
|
||||
Write-Host "L0.5 未执行:runner 缺 MSVC。"
|
||||
Write-Host "本地等价命令:& '.venv\Scripts\python.exe' scripts/ci_local.py"
|
||||
|
||||
Reference in New Issue
Block a user