已开启
test: validate PR pipeline checks #4
test: validate PR pipeline checks #4
已开启
BOCHENGZHANG创建于 9月11日
共 3 个文件变更+58-7
@@ -9,10 +9,17 @@ concurrency:
9 events: [mr_id]9 events: [mr_id]
10 10 
11on:11on:
12+ pr_comment:
13+ types: [created]
14+ keyword: '^(?:/)?compile*'
12 pull_request_comment:15 pull_request_comment:
13 types: [created]16 types: [created]
14- branches: ['master', '26.1.0']17+ branches: ['*']
15- comments: ['^compile$']18+ comments: ['^(?:/)?compile*']
19+ 
20+permissions:
21+ repository: read
22+ id-token: write
16 23 
17env:24env:
18 TARGET_BRANCH: ${{ atomgit.base_ref || 'master' }}25 TARGET_BRANCH: ${{ atomgit.base_ref || 'master' }}
@@ -23,6 +30,37 @@ stages:
23 name: CodeCheck30 name: CodeCheck
24 select: selected_by_default31 select: selected_by_default
25 jobs:32 jobs:
33+ SCA:
34+ name: SCA
35+ runs-on: [self-hosted, x86, cpu=32]
36+ steps:
37+ - name: checkout
38+ uses: checkout
39+ with:
40+ allow-unsafe-pr-checkout: true
41+ ref: refs/merge-requests/${{ env.pr_id }}/merge
42+ - name: run SCA PR scan
43+ uses: openlibing/sca-action/sca-pr-action@v1.0.0
44+ with:
45+ project-name: MindSpeed
46+ 
47+ Antipoison:
48+ name: Antipoison
49+ runs-on: [self-hosted, x86, cpu=32]
50+ steps:
51+ - name: checkout
52+ uses: checkout
53+ with:
54+ allow-unsafe-pr-checkout: true
55+ ref: refs/merge-requests/${{ env.pr_id }}/merge
56+ - name: run malicious code scan
57+ uses: openlibing/malicious-code-scan-action/malicious-code-pr-scan-action@v1.0.0
58+ with:
59+ repository-name: ${{ atomgit.repository }}
60+ pr-id: ${{ env.pr_id }}
61+ project-name: MindSpeed
62+ rule: Python
63+ 
26 CodeCheck_pre_commit:64 CodeCheck_pre_commit:
27 name: CodeCheck_pre_commit65 name: CodeCheck_pre_commit
28 runs-on: [self-hosted, x86, cpu=32]66 runs-on: [self-hosted, x86, cpu=32]
@@ -32,18 +70,24 @@ stages:
32 - name: checkout70 - name: checkout
33 uses: checkout71 uses: checkout
34 with:72 with:
73+ allow-unsafe-pr-checkout: true
35 ref: refs/merge-requests/${{ env.pr_id }}/merge74 ref: refs/merge-requests/${{ env.pr_id }}/merge
36- - name: setup-python31075+ - name: setup-python311
37- uses: setup-python76+ run: |
38- with:77+ set -eu
39- python-version: "3.10.20"78+ PYTHON311_BIN=$(dirname "$(command -v python3.11)")
79+ ln -sf "$(command -v python3.11)" "$PYTHON311_BIN/python"
80+ echo "$PYTHON311_BIN" >> "$ATOMGIT_PATH"
81+ "$PYTHON311_BIN/python" --version
40 - name: install gitleaks82 - name: install gitleaks
41 run: |83 run: |
84+ set -eu
42 cd "${ATOMGIT_WORKSPACE}"85 cd "${ATOMGIT_WORKSPACE}"
43 wget --no-host-directories -c --no-check-certificate https://pytorch-package.obs.cn-north-4.myhuaweicloud.com/pta-codecheck/gitleaks86 wget --no-host-directories -c --no-check-certificate https://pytorch-package.obs.cn-north-4.myhuaweicloud.com/pta-codecheck/gitleaks
44 chmod +x gitleaks87 chmod +x gitleaks
88+ cd -
45 - name: pre-commit89 - name: pre-commit
46- uses: openlibing-pre-commit-action90+ uses: openlibing/pre-commit-action@v1.0.0
47 91 
48 Detect_file_changes:92 Detect_file_changes:
49 name: Detect_file_changes93 name: Detect_file_changes
@@ -56,6 +100,7 @@ stages:
56 - name: checkout100 - name: checkout
57 uses: checkout101 uses: checkout
58 with:102 with:
103+ allow-unsafe-pr-checkout: true
59 ref: refs/merge-requests/${{ env.pr_id }}/merge104 ref: refs/merge-requests/${{ env.pr_id }}/merge
60 fetch-depth: 0105 fetch-depth: 0
61 - name: Only_doc_commit106 - name: Only_doc_commit
@@ -107,6 +152,7 @@ stages:
107 - name: checkout152 - name: checkout
108 uses: checkout153 uses: checkout
109 with:154 with:
155+ allow-unsafe-pr-checkout: true
110 ref: refs/merge-requests/${{ env.pr_id }}/merge156 ref: refs/merge-requests/${{ env.pr_id }}/merge
111 path: CODE157 path: CODE
112 fetch-depth: 0158 fetch-depth: 0
@@ -126,6 +172,7 @@ stages:
126 - name: checkout172 - name: checkout
127 uses: checkout173 uses: checkout
128 with:174 with:
175+ allow-unsafe-pr-checkout: true
129 ref: refs/merge-requests/${{ env.pr_id }}/merge176 ref: refs/merge-requests/${{ env.pr_id }}/merge
130 path: CODE177 path: CODE
131 fetch-depth: 0178 fetch-depth: 0
@@ -145,6 +192,7 @@ stages:
145 - name: checkout192 - name: checkout
146 uses: checkout193 uses: checkout
147 with:194 with:
195+ allow-unsafe-pr-checkout: true
148 ref: refs/merge-requests/${{ env.pr_id }}/merge196 ref: refs/merge-requests/${{ env.pr_id }}/merge
149 path: CODE197 path: CODE
150 fetch-depth: 0198 fetch-depth: 0
@@ -164,6 +212,7 @@ stages:
164 - name: checkout212 - name: checkout
165 uses: checkout213 uses: checkout
166 with:214 with:
215+ allow-unsafe-pr-checkout: true
167 ref: refs/merge-requests/${{ env.pr_id }}/merge216 ref: refs/merge-requests/${{ env.pr_id }}/merge
168 path: CODE217 path: CODE
169 fetch-depth: 0218 fetch-depth: 0
@@ -5,6 +5,7 @@ import argparse
5 5 
6 6 
7def read_files_from_txt(txt_file):7def read_files_from_txt(txt_file):
8+ # Branch-only marker for validating SCA and Antipoison PR checks.
8 with open(txt_file, "r", encoding='utf-8') as f:9 with open(txt_file, "r", encoding='utf-8') as f:
9 return [line.strip() for line in f.readlines()]10 return [line.strip() for line in f.readlines()]
10 11 
@@ -1 +1,2 @@
1# Python module initialization file1# Python module initialization file
2+# Validation marker for PR pipeline trigger.