diff options
| author | hydevcode <[email protected]> | 2025-05-23 09:33:23 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-23 09:33:23 +0800 |
| commit | 51b6df9c16b2261d7d4f0f7caa84d869b52fbd66 (patch) | |
| tree | af501edbba6ee4cfc674f152afa6002c75744dc8 /.github/workflows | |
| parent | 9e9669b47dc1989b41b2e7c57bc2e4fb8b303282 (diff) | |
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
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/bsp_buildings.yml | 59 | ||||
| -rw-r--r-- | .github/workflows/git_diff_status_show.yml | 50 |
2 files changed, 11 insertions, 98 deletions
diff --git a/.github/workflows/bsp_buildings.yml b/.github/workflows/bsp_buildings.yml index aef4f9c9e5..f4c7fdf76b 100644 --- a/.github/workflows/bsp_buildings.yml +++ b/.github/workflows/bsp_buildings.yml @@ -41,66 +41,29 @@ permissions: jobs: generate-matrix: runs-on: ubuntu-22.04 + name: 🔍 Summary of Git Diff Changes outputs: filtered_matrix: ${{ steps.filter.outputs.filtered_matrix }} steps: - name: Checkout repo uses: actions/checkout@main with: - sparse-checkout: .github/ALL_BSP_COMPILE.json persist-credentials: false - - name: Read matrix config - id: read-config - run: | - #读取ALL_BSP_COMPILE.json文件 - raw_matrix_base64=$(cat .github/ALL_BSP_COMPILE.json |egrep -v '^//'|base64 -w 0) - echo "raw_matrix=$raw_matrix_base64" >> $GITHUB_OUTPUT - - name: Get changed files - id: changed_files - if: github.event_name == 'pull_request' - run: | - changed_files=$(curl -s \ - "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \ - jq -r '.[].filename') - prefix=$(echo "$changed_files" | cut -d'/' -f1 | sort -u ) - has_bsp=true - for r in "$prefix"; do - if [[ ! "$r" == "bsp" ]]; then - has_bsp=false - break - fi - done - if [[ $has_bsp == true ]]; then - changed_files=$(echo "${changed_files}"| cut -d'/' -f2 | sort -u| tr '\n' ',' | sed 's/,$//') - echo "CHANGED_FILES=[${changed_files}]" >> $GITHUB_OUTPUT - fi - #获取修改文件的路径,如果有bsp以外的文件夹则编译全部bsp,否则获取对应文件夹名 - - echo "${changed_files}" + fetch-depth: 0 - name: Filter matrix id: filter run: | - raw_matrix=$(echo "${{ steps.read-config.outputs.raw_matrix }}" | base64 --decode) - - CHANGED_FILES=${{ steps.changed_files.outputs.CHANGED_FILES }} - CHANGED_FILES=$(echo "$CHANGED_FILES" | sed 's/\[\|\]//g') - # 将修改的文件路径与ALL_BSP_COMPILE.json文件的SUB_RTT_BSP进行判断,判断是否包含 - filtered_matrix=[] - echo "${CHANGED_FILES}" - if [[ -z "$CHANGED_FILES" ]]; then - FILTER_CONDITION='.legs[]' - filtered_matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix") - else - CONDITIONS=$(echo "$CHANGED_FILES" | awk 'BEGIN { RS="," } { printf "contains(\"%s\") or ", $1 }') - CONDITIONS=${CONDITIONS% or } - - FILTER_CONDITION=".legs[] | select(any(.SUB_RTT_BSP[]; $CONDITIONS))" - - filtered_matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix") - fi + git config --global http.postBuffer 524288000 + git remote -v + git fetch origin + git branch + git branch -a + python tools/ci/git_diff_show.py origin/master + raw_matrix=$(cat .github/ALL_BSP_COMPILE_TEMP.json) + FILTER_CONDITION='.legs[]' + filtered_matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix") echo "filtered_matrix=${filtered_matrix}" >> $GITHUB_OUTPUT - echo ${filtered_matrix} build: runs-on: ubuntu-22.04 diff --git a/.github/workflows/git_diff_status_show.yml b/.github/workflows/git_diff_status_show.yml deleted file mode 100644 index f63cafed26..0000000000 --- a/.github/workflows/git_diff_status_show.yml +++ /dev/null @@ -1,50 +0,0 @@ -# -# Copyright (c) 2006-2023, RT-Thread Development Team -# -# SPDX-License-Identifier: Apache-2.0 -# -# Change Logs: -# Date Author Notes -# 2025-05-15 Supper Thomas show the PR size -# - -name: PR status - -# 这个ci主要用来显示当前的PR对于master节点上的增加的code size有多大 -on: - pull_request: - branches: - - master - -permissions: - contents: read # to fetch code (actions/checkout) - -jobs: - build: - runs-on: ubuntu-24.04 - name: PR status show - - steps: - - uses: actions/checkout@main - with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@main - with: - python-version: 3.8 - - - name: fetch origin - shell: bash - run: | - git config --global http.postBuffer 524288000 - git remote -v - git fetch origin - git branch - git branch -a - - - name: PR status show - if: ${{ success() }} - shell: bash - run: | - python tools/ci/git_diff_status_show.py origin/master - |
