CI: build: Add support to use container included external toolchain
authorChristian Marangi <ansuelsmth@gmail.com>
Sat, 17 Dec 2022 14:07:28 +0000 (15:07 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Tue, 23 May 2023 21:33:14 +0000 (23:33 +0200)
Add support to use container included external toolchain and skip
redownloading external sdk for each test.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
.github/workflows/build.yml
.github/workflows/coverity.yml
.github/workflows/kernel.yml
.github/workflows/packages.yml

index f60e4748a096c0f4cfd89dfb3e88b4762b4b262b..fd93d5f80225ec388c70c0ef4a6c328e890a30a7 100644 (file)
@@ -206,6 +206,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
@@ -259,7 +264,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: |
@@ -296,6 +301,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}"
index db59ef8ca68e86f35a7bc72b3b35555ae2f98368..10355456321513f005fb1198d561448c759e1b1e 100644 (file)
@@ -17,6 +17,7 @@ jobs:
       packages: read
     uses: ./.github/workflows/build.yml
     with:
+      container_name: toolchain
       target: x86
       subtarget: 64
       build_full: true
index 02aee8b27cc8ad9e645a5dd5a5376888ea334f36..b918b2d88e431e459e761269399086dd504a4137 100644 (file)
@@ -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
index e2f932b1ba3d4230f509118d7e1429229a37bdb7..d8270cbb820747f2fc473324385292d8043a7250 100644 (file)
@@ -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