From 7bac4bdb001c8301b87a1cdc3e85d8c2d2716394 Mon Sep 17 00:00:00 2001 From: CYFS <2805686936@qq.com> Date: Mon, 29 Sep 2025 21:36:03 +0800 Subject: [PATCH] ci: add concurrency control to GitHub Actions --- .github/workflows/action_tools.yml | 6 +++++- .github/workflows/auto_assign_reviewers.yml | 4 ++++ .github/workflows/auto_labeler.yml | 4 ++++ .github/workflows/bsp_buildings.yml | 4 ++++ .github/workflows/compile_bsp_with_drivers.yml | 6 +++++- .github/workflows/doxygen.yml | 6 +++++- .github/workflows/format_check.yml | 6 +++++- .github/workflows/pkgs_test.yml | 7 +++++-- .github/workflows/pr_clang_format.yml | 6 +++++- .github/workflows/pr_format_bot.yml | 7 ++++++- .github/workflows/static_code_analysis.yml | 6 +++++- .github/workflows/utest_auto_run.yml | 4 ++++ 12 files changed, 57 insertions(+), 9 deletions(-) diff --git a/.github/workflows/action_tools.yml b/.github/workflows/action_tools.yml index 7c29a6e7fff..b3e1b954d4e 100644 --- a/.github/workflows/action_tools.yml +++ b/.github/workflows/action_tools.yml @@ -29,6 +29,10 @@ on: workflow_dispatch: repository_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: contents: read # to fetch code (actions/checkout) @@ -93,4 +97,4 @@ jobs: scons --pyconfig-silent -C $TEST_BSP_ROOT/dist/project scons --pyconfig-silent -C $TEST_BSP_ROOT/rt-studio-project scons -C $TEST_BSP_ROOT/dist/project - scons -C $TEST_BSP_ROOT/rt-studio-project + scons -C $TEST_BSP_ROOT/rt-studio-project \ No newline at end of file diff --git a/.github/workflows/auto_assign_reviewers.yml b/.github/workflows/auto_assign_reviewers.yml index cde7d3dbca5..1c75b8388e2 100644 --- a/.github/workflows/auto_assign_reviewers.yml +++ b/.github/workflows/auto_assign_reviewers.yml @@ -20,6 +20,10 @@ on: branches: [ master ] types: [opened, synchronize, reopened] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: assign-reviewers: runs-on: ubuntu-22.04 diff --git a/.github/workflows/auto_labeler.yml b/.github/workflows/auto_labeler.yml index e75f90740d6..e5c1c2d9ce2 100644 --- a/.github/workflows/auto_labeler.yml +++ b/.github/workflows/auto_labeler.yml @@ -15,6 +15,10 @@ name: "Pull Request Labeler" on: - pull_request_target +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: labeler: permissions: diff --git a/.github/workflows/bsp_buildings.yml b/.github/workflows/bsp_buildings.yml index 388f6f2354e..b2b7d7eb187 100644 --- a/.github/workflows/bsp_buildings.yml +++ b/.github/workflows/bsp_buildings.yml @@ -47,6 +47,10 @@ on: - online-pkgs-static-building-trigger-event workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: contents: read # to fetch code (actions/checkout) diff --git a/.github/workflows/compile_bsp_with_drivers.yml b/.github/workflows/compile_bsp_with_drivers.yml index 97a5deded6e..d9205c735f9 100644 --- a/.github/workflows/compile_bsp_with_drivers.yml +++ b/.github/workflows/compile_bsp_with_drivers.yml @@ -15,6 +15,10 @@ name: BSP compilation with more drivers on: workflow_dispatch: #disable +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: contents: read # to fetch code (actions/checkout) @@ -54,4 +58,4 @@ jobs: shell: bash run: | # source ~/.env/env.sh - # python tools/ci/compile_bsp_with_drivers.py + # python tools/ci/compile_bsp_with_drivers.py \ No newline at end of file diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index e2c51a8625f..151d89b1fd0 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -31,6 +31,10 @@ on: schedule: - cron: '0 16 30 * *' workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true permissions: contents: read @@ -74,4 +78,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@main + uses: actions/deploy-pages@main \ No newline at end of file diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml index 0273c11d9bd..5c40a91a16d 100644 --- a/.github/workflows/format_check.yml +++ b/.github/workflows/format_check.yml @@ -9,6 +9,10 @@ on: - '**/README.md' - '**/README_zh.md' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: scancode_job: runs-on: ubuntu-22.04 @@ -25,4 +29,4 @@ jobs: shell: bash run: | pip install click chardet PyYaml - python tools/ci/file_check.py check 'https://github.com/RT-Thread/rt-thread' 'master' + python tools/ci/file_check.py check 'https://github.com/RT-Thread/rt-thread' 'master' \ No newline at end of file diff --git a/.github/workflows/pkgs_test.yml b/.github/workflows/pkgs_test.yml index 87e70fb35ca..1ef1b2fa224 100644 --- a/.github/workflows/pkgs_test.yml +++ b/.github/workflows/pkgs_test.yml @@ -17,6 +17,10 @@ on: - '**/README_zh.md' workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: change: uses: RT-Thread/pkgs-test/.github/workflows/pkgs-action.yml@main @@ -25,5 +29,4 @@ jobs: rt-thread-versions: "branch:master" test-specific-pkgs: true pkgs: | - hello - + hello \ No newline at end of file diff --git a/.github/workflows/pr_clang_format.yml b/.github/workflows/pr_clang_format.yml index 2e2dd16d4a7..1f4d1fdc621 100644 --- a/.github/workflows/pr_clang_format.yml +++ b/.github/workflows/pr_clang_format.yml @@ -16,6 +16,10 @@ on: required: true default: '' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: contents: write pull-requests: read @@ -262,4 +266,4 @@ jobs: echo "排除模式: ${{ github.event.inputs.exclude_patterns || '无' }}" echo "处理文件数: ${{ steps.find-files.outputs.files_count }}" echo "有更改: ${{ steps.check-changes.outputs.has_changes }}" - echo "clang-format 版本: $(clang-format --version | head -1)" + echo "clang-format 版本: $(clang-format --version | head -1)" \ No newline at end of file diff --git a/.github/workflows/pr_format_bot.yml b/.github/workflows/pr_format_bot.yml index 25628013a46..3e2ee2ba145 100644 --- a/.github/workflows/pr_format_bot.yml +++ b/.github/workflows/pr_format_bot.yml @@ -3,6 +3,11 @@ on: pull_request_target: types: [opened] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: pull-requests: write contents: read @@ -133,4 +138,4 @@ jobs: echo "Failed to get commits from GitHub API" echo "Response: $commits" exit 1 - fi + fi \ No newline at end of file diff --git a/.github/workflows/static_code_analysis.yml b/.github/workflows/static_code_analysis.yml index 9e2d4b4e938..3a5fdb34f54 100644 --- a/.github/workflows/static_code_analysis.yml +++ b/.github/workflows/static_code_analysis.yml @@ -19,6 +19,10 @@ on: - '**/README.md' - '**/README_zh.md' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: scancode_job: runs-on: ubuntu-22.04 @@ -50,4 +54,4 @@ jobs: sudo make install FILESDIR=/usr/local/share/Cppcheck cppcheck --version cd .. - python tools/ci/cpp_check.py check + python tools/ci/cpp_check.py check \ No newline at end of file diff --git a/.github/workflows/utest_auto_run.yml b/.github/workflows/utest_auto_run.yml index a1abf0a1dde..1bc63010291 100644 --- a/.github/workflows/utest_auto_run.yml +++ b/.github/workflows/utest_auto_run.yml @@ -19,6 +19,10 @@ on: - '**/README.md' - '**/README_zh.md' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: contents: read