This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new cb1b1863c06 ci: Serialize CI jobs to avoid unnecessary pipeline 
execution
cb1b1863c06 is described below

commit cb1b1863c06097d8d8e51961a93c60966064a85a
Author: trns1997 <[email protected]>
AuthorDate: Fri Oct 10 15:21:05 2025 +0200

    ci: Serialize CI jobs to avoid unnecessary pipeline execution
    
    - Split workflows into sequential jobs within a single workflow to
      ensure later stages run only after earlier ones succeed.
    - Prevents running CI stages when prior checks would fail or are
      irrelevant (e.g., draft PRs).
    - Simplifies future conditional guards for skipping jobs based on
      PR or branch state.
    - Improves CI efficiency by focusing pipeline execution on meaningful work.
    
    Signed-off-by: trns1997 <[email protected]>
---
 .github/workflows/check.yml             | 49 -------------------
 .github/workflows/{build.yml => ci.yml} | 86 ++++++++++++++++++++++++++++++---
 .github/workflows/lint.yml              | 34 -------------
 3 files changed, 78 insertions(+), 91 deletions(-)

diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
deleted file mode 100644
index b7ff183a7be..00000000000
--- a/.github/workflows/check.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-name: Check
-
-on:
-  pull_request:
-    paths-ignore:
-      - 'Documentation/**'
-
-concurrency:
-  group: check-${{ github.event.pull_request.number || github.ref }}
-  cancel-in-progress: true
-
-permissions:
-  contents: read
-
-jobs:
-  check:
-    runs-on: ubuntu-latest
-
-    steps:
-      - name: Checkout nuttx repo
-        uses: actions/checkout@v5
-        with:
-          repository: apache/nuttx
-          path: nuttx
-          fetch-depth: 0
-
-      - name: Check Pull Request
-        run: |
-          echo "::add-matcher::nuttx/.github/nxstyle.json"
-          python3 -m venv .venv
-          source .venv/bin/activate
-          pip install codespell cmake-format black isort flake8 cvt2utf
-          cd nuttx
-          commits="${{ github.event.pull_request.base.sha }}..HEAD"
-          git log --oneline $commits
-          echo "../nuttx/tools/checkpatch.sh -c -u -m -g $commits"
-          ../nuttx/tools/checkpatch.sh -c -u -m -g $commits
diff --git a/.github/workflows/build.yml b/.github/workflows/ci.yml
similarity index 85%
rename from .github/workflows/build.yml
rename to .github/workflows/ci.yml
index dce9cd5d756..9f5e18d6e82 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/ci.yml
@@ -10,7 +10,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-name: Build
+name: CI Pipeline
 
 on:
   pull_request:
@@ -34,13 +34,83 @@ permissions:
   contents: read
 
 concurrency:
-  group: build-${{ github.event.pull_request.number || github.ref }}
+  group: ci-${{ github.event.pull_request.number || github.ref }}
   cancel-in-progress: true
 
 jobs:
+  # --- Draft guard ---
+  draft-check:
+    runs-on: ubuntu-latest
+    outputs:
+      skip: ${{ steps.check.outputs.skip }}
+    steps:
+      - id: check
+        run: |
+          if [ "${{ github.event_name }}" = "pull_request" ] && [ "${{ 
github.event.pull_request.draft }}" = "true" ]; then
+            echo "Draft PR detected — skipping pipeline."
+            echo "skip=true" >> $GITHUB_OUTPUT
+          else
+            echo "PR is ready or push event — continuing pipeline."
+            echo "skip=false" >> $GITHUB_OUTPUT
+          fi
+
+  # --- Check job ---
+  check:
+    needs: draft-check
+    if: ${{ needs.draft-check.outputs.skip != 'true' }}
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout nuttx repo
+        uses: actions/checkout@v5
+        with:
+          repository: apache/nuttx
+          path: nuttx
+          fetch-depth: 0
+
+      - name: Check Pull Request
+        run: |
+          echo "::add-matcher::nuttx/.github/nxstyle.json"
+          python3 -m venv .venv
+          source .venv/bin/activate
+          pip install codespell cmake-format black isort flake8 cvt2utf
+          cd nuttx
+          commits="${{ github.event.pull_request.base.sha }}..HEAD"
+          git log --oneline $commits
+          echo "../nuttx/tools/checkpatch.sh -c -u -m -g $commits"
+          ../nuttx/tools/checkpatch.sh -c -u -m -g $commits
+
+  # --- Lint job ---
+  lint:
+    needs: check
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      statuses: write
+
+    steps:
+      - uses: actions/checkout@v5
+        with:
+          fetch-depth: 0
 
+      - run: mkdir super-linter.report
+
+      - name: Lint
+        uses: github/super-linter@v7
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          VALIDATE_ALL_CODEBASE: false
+          VALIDATE_PYTHON_BLACK: true
+          VALIDATE_PYTHON_FLAKE8: true
+          PYTHON_FLAKE8_CONFIG_FILE: setup.cfg
+          VALIDATE_PYTHON_ISORT: true
+          PYTHON_ISORT_CONFIG_FILE: setup.cfg
+          VALIDATE_YAML: true
+
+  # --- Build job ---
   # Fetch the source from nuttx and nuttx-apps repos
   Fetch-Source:
+    needs: lint
     runs-on: ubuntu-latest
     steps:
       - name: Determine Target Branches
@@ -124,8 +194,8 @@ jobs:
 
   # Select the Linux Builds based on PR Arch Label
   Linux-Arch:
-    uses: apache/nuttx/.github/workflows/arch.yml@master
     needs: Fetch-Source
+    uses: apache/nuttx/.github/workflows/arch.yml@master
     with:
       os: Linux
       boards: |
@@ -248,8 +318,8 @@ jobs:
 
   # Select the macOS Builds based on PR Arch Label
   macOS-Arch:
-    uses: apache/nuttx/.github/workflows/arch.yml@master
     needs: Fetch-Source
+    uses: apache/nuttx/.github/workflows/arch.yml@master
     with:
       os: macOS
       boards: |
@@ -257,10 +327,10 @@ jobs:
 
   # Run the selected macOS Builds
   macOS:
+    needs: macOS-Arch
+    runs-on: macos-13
     permissions:
       contents: none
-    runs-on: macos-13
-    needs: macOS-Arch
     if: ${{ needs.macOS-Arch.outputs.skip_all_builds != '1' }}
     strategy:
       max-parallel: 2
@@ -308,8 +378,8 @@ jobs:
 
   # Select the msys2 Builds based on PR Arch Label
   msys2-Arch:
-    uses: apache/nuttx/.github/workflows/arch.yml@master
     needs: Fetch-Source
+    uses: apache/nuttx/.github/workflows/arch.yml@master
     with:
       os: msys2
       boards: |
@@ -390,8 +460,8 @@ jobs:
 
   # Select the msvc Builds based on PR Arch Label
   msvc-Arch:
-    uses: apache/nuttx/.github/workflows/arch.yml@master
     needs: Fetch-Source
+    uses: apache/nuttx/.github/workflows/arch.yml@master
     with:
       os: msvc
       boards: |
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
deleted file mode 100644
index 33e042803d8..00000000000
--- a/.github/workflows/lint.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-name: Lint
-
-on: [pull_request]
-
-concurrency:
-  group: lint-${{ github.event.pull_request.number || github.ref }}
-  cancel-in-progress: true
-
-permissions:
-  contents: read
-
-jobs:
-  lint:
-    permissions:
-      contents: read  # for actions/checkout to fetch code
-      statuses: write  # for github/super-linter to mark status of each linter 
run
-    name: Lint
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v5
-        with:
-          fetch-depth: 0
-      - run: mkdir super-linter.report
-      - name: Lint
-        uses: github/super-linter@v7
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          VALIDATE_ALL_CODEBASE: false
-          VALIDATE_PYTHON_BLACK: true
-          VALIDATE_PYTHON_FLAKE8: true
-          PYTHON_FLAKE8_CONFIG_FILE: setup.cfg
-          VALIDATE_PYTHON_ISORT: true
-          PYTHON_ISORT_CONFIG_FILE: setup.cfg
-          VALIDATE_YAML: true

Reply via email to