已开启
fix(ci): 移除 op-plugin ignore=dirty 并新增子模块 pin 一致性检查 #46296
fix(ci): 移除 op-plugin ignore=dirty 并新增子模块 pin 一致性检查 #46296
已开启
TheoCui创建于 27 天前
共 3 个文件变更+25-1
@@ -45,6 +45,9 @@ jobs:
45 submodules: recursive45 submodules: recursive
46 allow-unsafe-pr-checkout: true46 allow-unsafe-pr-checkout: true
47 47 
48+ - name: check submodule pins
49+ run: bash ci/check_submodule_pins.sh
50+ 
48 - name: install torch51 - name: install torch
49 if: ${{ inputs.torch_branch == 'master' }}52 if: ${{ inputs.torch_branch == 'master' }}
50 run: |53 run: |
@@ -1,7 +1,6 @@
1[submodule "third_party/op-plugin"]1[submodule "third_party/op-plugin"]
2 path = third_party/op-plugin2 path = third_party/op-plugin
3 url = https://gitcode.com/ascend/op-plugin.git3 url = https://gitcode.com/ascend/op-plugin.git
4- ignore = dirty
5[submodule "third_party/googletest"]4[submodule "third_party/googletest"]
6 path = third_party/googletest5 path = third_party/googletest
7 url = https://gitcode.com/GitHub_Trending/go/googletest.git6 url = https://gitcode.com/GitHub_Trending/go/googletest.git
@@ -0,0 +1,22 @@
1+#!/bin/bash
2+# 校验每个子模块 pin 的 commit 在其 .gitmodules 记录的 URL 上存在,
3+# 防止镜像 fork 缺失 pin(构建时 recursive clone 会 404)。
4+set -euo pipefail
5+ 
6+fail=0
7+while read -r key url; do
8+ path=${key#submodule.}; path=${path%.url}
9+ sha=$(git ls-tree HEAD -- "$path" | awk '$1 == "160000" {print $3}')
10+ if [ -z "$sha" ]; then
11+ echo "[check-submodule-pins] $path: HEAD 中无 gitlink,跳过"
12+ continue
13+ fi
14+ if git fetch --dry-run "$url" "$sha" >/dev/null 2>&1; then
15+ echo "[check-submodule-pins] $path: OK ($sha @ $url)"
16+ else
17+ echo "[check-submodule-pins] $path: pin $sha 在 $url 上不可达" >&2
18+ fail=1
19+ fi
20+done < <(git config -f .gitmodules --get-regexp 'submodule\..*\.url')
21+ 
22+exit $fail