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

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 9b102d3c93a626ade0b057051666e6e1cedd8dda
Author: Szymon Janc <[email protected]>
AuthorDate: Wed Oct 21 21:47:09 2026 +0200

    ci: Build GCC test target with all releases in single job
    
    GCC test target was built in matrix job, one job per toolchain release.
    Each of those 8 jobs restored project artifact and own ccache for
    building single target, which took longer than the build itself.
    
    Build all releases in single job instead, same as in
    apache-mynewt-core. Project and ccache are restored once and new
    gcc-target-build composite action installs each release, builds target
    with it and removes it afterwards. Builds for remaining releases run
    even if one fails, so job reports all failing releases. All releases
    share single ccache with bigger size limit, entries are separated by
    CCACHE_COMPILERCHECK=content.
    
    This also lowers number of concurrent jobs in workflow, which is
    limited by ASF policy.
    
    Assisted-by: Claude:claude-opus-5-5
---
 .github/actions/ccache-restore/action.yml   |  3 +-
 .github/actions/gcc-target-build/action.yml | 65 ++++++++++++++++++++++++++++
 .github/workflows/build.yml                 | 66 +++++++++++++++++++++--------
 3 files changed, 116 insertions(+), 18 deletions(-)

diff --git a/.github/actions/ccache-restore/action.yml 
b/.github/actions/ccache-restore/action.yml
index 13ae7ab5c..e754643ca 100644
--- a/.github/actions/ccache-restore/action.yml
+++ b/.github/actions/ccache-restore/action.yml
@@ -21,7 +21,8 @@ name: Restore ccache
 description: >
   Install ccache, put it in front of compilers used by newt and restore
   ccache directory from cache. Must be used after toolchain is installed
-  so that ccache wrappers are found in PATH before real compilers.
+  so that ccache wrappers are found in PATH before real compilers (unless
+  job sets PATH itself, see gcc-target-build).
   Supported only on Linux, does nothing on other systems.
 
 inputs:
diff --git a/.github/actions/gcc-target-build/action.yml 
b/.github/actions/gcc-target-build/action.yml
new file mode 100644
index 000000000..92c409988
--- /dev/null
+++ b/.github/actions/gcc-target-build/action.yml
@@ -0,0 +1,65 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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: Build GCC test target
+description: >
+  Install given release of GNU Arm Embedded Toolchain, build cc_test
+  target with it and remove it afterwards. Used to build test target with
+  many toolchain releases in single job. Expects project with cc_test
+  target restored in build directory and ccache restored.
+
+inputs:
+  release:
+    description: GNU Arm Embedded Toolchain release name
+    required: true
+
+runs:
+  using: composite
+  steps:
+    - name: Install toolchain
+      id: gcc
+      uses: carlosperate/[email protected]
+      with:
+        release: ${{ inputs.release }}
+
+    - name: Build target
+      shell: bash
+      env:
+        GCC_PATH: ${{ steps.gcc.outputs.path }}
+      run: |
+        # Toolchain action only prepends to PATH so it also contains
+        # previously installed releases. Set PATH explicitly, ccache
+        # wrappers first so that they find this toolchain as next one.
+        export PATH="$RUNNER_TEMP/ccache-bin:$GCC_PATH:$PATH"
+        arm-none-eabi-gcc --version | head -1
+        cd build
+        # Command lines are same for all releases, so newt would not
+        # rebuild objects built with previous toolchain release.
+        rm -rf bin
+        newt build cc_test
+
+    - name: Remove toolchain
+      if: always() && steps.gcc.outputs.path != ''
+      shell: bash
+      env:
+        GCC_PATH: ${{ steps.gcc.outputs.path }}
+      run: |
+        # Toolchain is installed in directory in home directory
+        dir="${GCC_PATH#"$HOME"/}"
+        rm -rf "$HOME/${dir%%/*}"
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1759c6c4f..48fce2ac8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -207,26 +207,13 @@ jobs:
   gcc-target:
     name: Build GCC test target
     needs: prepare
-    strategy:
-      fail-fast: false
-      # Limit number of parallel jobs, ASF policy limits job concurrency
-      # level per workflow
-      max-parallel: 4
-      matrix:
-        gcc: ['15.2.Rel1', '14.2.Rel1', '13.2.Rel1', '12.2.Rel1', '11.3.Rel1', 
'10.3-2021.10', '9-2020-q2', '8-2019-q3']
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v7
-      - uses: carlosperate/[email protected]
-        with:
-          release: ${{ matrix.gcc }}
       - name: Restore project
         uses: ./.github/actions/newt-project-restore
-      - name: Restore ccache
-        uses: ./.github/actions/ccache-restore
-        with:
-          key: gcc-target-${{ matrix.gcc }}
-      - name: Build test target
+      - name: Create test target
+        id: target
         shell: bash
         run: |
              cd build
@@ -234,12 +221,57 @@ jobs:
              newt target set cc_test 
bsp="@apache-mynewt-core/hw/bsp/nordic_pca10056"
              newt target set cc_test app="@apache-mynewt-nimble/apps/btshell"
              cp -f ../.github/test_build_apps_syscfg.yml 
targets/cc_test/syscfg.yml
-             newt build cc_test
+      - name: Restore ccache
+        uses: ./.github/actions/ccache-restore
+        with:
+          key: gcc-target
+          max-size: 1G
+      # Build with remaining releases even if build with one fails
+      - name: Build with GCC 15.2.Rel1
+        if: ${{ !cancelled() && steps.target.outcome == 'success' }}
+        uses: ./.github/actions/gcc-target-build
+        with:
+          release: 15.2.Rel1
+      - name: Build with GCC 14.2.Rel1
+        if: ${{ !cancelled() && steps.target.outcome == 'success' }}
+        uses: ./.github/actions/gcc-target-build
+        with:
+          release: 14.2.Rel1
+      - name: Build with GCC 13.2.Rel1
+        if: ${{ !cancelled() && steps.target.outcome == 'success' }}
+        uses: ./.github/actions/gcc-target-build
+        with:
+          release: 13.2.Rel1
+      - name: Build with GCC 12.2.Rel1
+        if: ${{ !cancelled() && steps.target.outcome == 'success' }}
+        uses: ./.github/actions/gcc-target-build
+        with:
+          release: 12.2.Rel1
+      - name: Build with GCC 11.3.Rel1
+        if: ${{ !cancelled() && steps.target.outcome == 'success' }}
+        uses: ./.github/actions/gcc-target-build
+        with:
+          release: 11.3.Rel1
+      - name: Build with GCC 10.3-2021.10
+        if: ${{ !cancelled() && steps.target.outcome == 'success' }}
+        uses: ./.github/actions/gcc-target-build
+        with:
+          release: 10.3-2021.10
+      - name: Build with GCC 9-2020-q2
+        if: ${{ !cancelled() && steps.target.outcome == 'success' }}
+        uses: ./.github/actions/gcc-target-build
+        with:
+          release: 9-2020-q2
+      - name: Build with GCC 8-2019-q3
+        if: ${{ !cancelled() && steps.target.outcome == 'success' }}
+        uses: ./.github/actions/gcc-target-build
+        with:
+          release: 8-2019-q3
       - name: Save ccache
         if: always()
         uses: ./.github/actions/ccache-save
         with:
-          key: gcc-target-${{ matrix.gcc }}
+          key: gcc-target
 
   unit-tests:
     name: Run unit tests

Reply via email to