[openwrt/openwrt] CI: build: Add support to use container included external toolchain

LEDE Commits lede-commits at lists.infradead.org
Tue Oct 24 08:14:35 PDT 2023


ansuel pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/e83384b87e2d3789800084bedc7ae3be2b203663

commit e83384b87e2d3789800084bedc7ae3be2b203663
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Sat Dec 17 15:07:28 2022 +0100

    CI: build: Add support to use container included external toolchain
    
    Add support to use container included external toolchain and skip
    redownloading external sdk for each test.
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
    (cherry picked from commit 0fe5776f4a79a2b095912e258738e3203207e9dd)
---
 .github/workflows/build.yml    | 21 ++++++++++++++++++++-
 .github/workflows/coverity.yml |  1 +
 .github/workflows/kernel.yml   |  1 +
 .github/workflows/packages.yml |  1 +
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c3843d1dfc..6948caf11e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -176,6 +176,11 @@ jobs:
         id: parse-toolchain
         working-directory: openwrt
         run: |
+          if [ -d /external-toolchain/ ]; then
+            echo "toolchain-type=external_container" >> $GITHUB_OUTPUT
+            exit 0
+          fi
+
           TOOLCHAIN_PATH=snapshots
 
           if [ -n "${{ github.base_ref }}" ]; then
@@ -251,7 +256,7 @@ jobs:
             ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-
 
       - name: Download external toolchain/sdk
-        if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal'
+        if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container'
         shell: su buildbot -c "sh -e {0}"
         working-directory: openwrt
         run: |
@@ -288,6 +293,20 @@ jobs:
           echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config
           echo CONFIG_TARGET_ALL_PROFILES=y >> .config
 
+      - name: Configure external toolchain in container
+        if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_container'
+        shell: su buildbot -c "sh -e {0}"
+        working-directory: openwrt
+        run: |
+          echo CONFIG_DEVEL=y >> .config
+          echo CONFIG_AUTOREMOVE=y >> .config
+          echo CONFIG_CCACHE=y >> .config
+
+          ./scripts/ext-toolchain.sh \
+            --toolchain /external-toolchain/$(ls /external-toolchain/ | grep openwrt-toolchain)/toolchain-* \
+            --overwrite-config \
+            --config ${{ inputs.target }}/${{ inputs.subtarget }}
+
       - name: Configure external toolchain
         if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain'
         shell: su buildbot -c "sh -e {0}"
diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml
index db59ef8ca6..1035545632 100644
--- a/.github/workflows/coverity.yml
+++ b/.github/workflows/coverity.yml
@@ -17,6 +17,7 @@ jobs:
       packages: read
     uses: ./.github/workflows/build.yml
     with:
+      container_name: toolchain
       target: x86
       subtarget: 64
       build_full: true
diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml
index 02aee8b27c..b918b2d88e 100644
--- a/.github/workflows/kernel.yml
+++ b/.github/workflows/kernel.yml
@@ -109,6 +109,7 @@ jobs:
          include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}}
     uses: ./.github/workflows/build.yml
     with:
+      container_name: toolchain
       target: ${{ matrix.target }}
       subtarget: ${{ matrix.subtarget }}
       build_kernel: true
diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml
index e2f932b1ba..d8270cbb82 100644
--- a/.github/workflows/packages.yml
+++ b/.github/workflows/packages.yml
@@ -43,6 +43,7 @@ jobs:
             subtarget: 64
     uses: ./.github/workflows/build.yml
     with:
+      container_name: toolchain
       target: ${{ matrix.target }}
       subtarget: ${{ matrix.subtarget }}
       build_kernel: true




More information about the lede-commits mailing list