Skip to content

Commit 51b6df9

Browse files
authored
ci: Replace the judgment file modification mechanism of bsp_building.… (#10314)
ci: Replace the judgment file modification mechanism of bsp_building.yml and incorporate the PR status show into bsp_building.yml
1 parent 9e9669b commit 51b6df9

File tree

4 files changed

+383
-299
lines changed

4 files changed

+383
-299
lines changed

.github/workflows/bsp_buildings.yml

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -41,66 +41,29 @@ permissions:
4141
jobs:
4242
generate-matrix:
4343
runs-on: ubuntu-22.04
44+
name: 🔍 Summary of Git Diff Changes
4445
outputs:
4546
filtered_matrix: ${{ steps.filter.outputs.filtered_matrix }}
4647
steps:
4748
- name: Checkout repo
4849
uses: actions/checkout@main
4950
with:
50-
sparse-checkout: .github/ALL_BSP_COMPILE.json
5151
persist-credentials: false
52-
- name: Read matrix config
53-
id: read-config
54-
run: |
55-
#读取ALL_BSP_COMPILE.json文件
56-
raw_matrix_base64=$(cat .github/ALL_BSP_COMPILE.json |egrep -v '^//'|base64 -w 0)
57-
echo "raw_matrix=$raw_matrix_base64" >> $GITHUB_OUTPUT
58-
- name: Get changed files
59-
id: changed_files
60-
if: github.event_name == 'pull_request'
61-
run: |
62-
changed_files=$(curl -s \
63-
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
64-
jq -r '.[].filename')
65-
prefix=$(echo "$changed_files" | cut -d'/' -f1 | sort -u )
66-
has_bsp=true
67-
for r in "$prefix"; do
68-
if [[ ! "$r" == "bsp" ]]; then
69-
has_bsp=false
70-
break
71-
fi
72-
done
73-
if [[ $has_bsp == true ]]; then
74-
changed_files=$(echo "${changed_files}"| cut -d'/' -f2 | sort -u| tr '\n' ',' | sed 's/,$//')
75-
echo "CHANGED_FILES=[${changed_files}]" >> $GITHUB_OUTPUT
76-
fi
77-
#获取修改文件的路径,如果有bsp以外的文件夹则编译全部bsp,否则获取对应文件夹名
78-
79-
echo "${changed_files}"
52+
fetch-depth: 0
8053
- name: Filter matrix
8154
id: filter
8255
run: |
83-
raw_matrix=$(echo "${{ steps.read-config.outputs.raw_matrix }}" | base64 --decode)
84-
85-
CHANGED_FILES=${{ steps.changed_files.outputs.CHANGED_FILES }}
86-
CHANGED_FILES=$(echo "$CHANGED_FILES" | sed 's/\[\|\]//g')
87-
# 将修改的文件路径与ALL_BSP_COMPILE.json文件的SUB_RTT_BSP进行判断,判断是否包含
88-
filtered_matrix=[]
89-
echo "${CHANGED_FILES}"
90-
if [[ -z "$CHANGED_FILES" ]]; then
91-
FILTER_CONDITION='.legs[]'
92-
filtered_matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix")
93-
else
94-
CONDITIONS=$(echo "$CHANGED_FILES" | awk 'BEGIN { RS="," } { printf "contains(\"%s\") or ", $1 }')
95-
CONDITIONS=${CONDITIONS% or }
96-
97-
FILTER_CONDITION=".legs[] | select(any(.SUB_RTT_BSP[]; $CONDITIONS))"
98-
99-
filtered_matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix")
100-
fi
56+
git config --global http.postBuffer 524288000
57+
git remote -v
58+
git fetch origin
59+
git branch
60+
git branch -a
61+
python tools/ci/git_diff_show.py origin/master
62+
raw_matrix=$(cat .github/ALL_BSP_COMPILE_TEMP.json)
10163
64+
FILTER_CONDITION='.legs[]'
65+
filtered_matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix")
10266
echo "filtered_matrix=${filtered_matrix}" >> $GITHUB_OUTPUT
103-
10467
echo ${filtered_matrix}
10568
build:
10669
runs-on: ubuntu-22.04

.github/workflows/git_diff_status_show.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)