CI: build: package external toolchain after build
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 20 Dec 2022 19:02:35 +0000 (20:02 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Tue, 23 May 2023 21:24:51 +0000 (23:24 +0200)
Package external toolchain after correct build.

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

index 52fba8e10639b5eab75d85d25f6552149e740226..0e5f36c1120121264e856ab783003973a01537a9 100644 (file)
@@ -47,6 +47,10 @@ on:
           mbedtls
           wolfssl
           openssl
+      build_external_toolchain:
+        type: boolean
+      upload_external_toolchain:
+        type: boolean
 
 permissions:
   contents: read
@@ -376,6 +380,12 @@ jobs:
         working-directory: openwrt
         run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
 
+      - name: Build external toolchain
+        if: inputs.build_external_toolchain == true
+        shell: su buildbot -c "sh -e {0}"
+        working-directory: openwrt
+        run: make target/toolchain/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
+
       - name: Coverity prepare toolchain
         if: inputs.coverity_check_packages != ''
         shell: su buildbot -c "sh -e {0}"
@@ -433,3 +443,19 @@ jobs:
         with:
           name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs
           path: "openwrt/logs"
+
+      - name: Find external toolchain name
+        id: get-toolchain-name
+        if: inputs.upload_external_toolchain == true
+        working-directory: openwrt
+        run: |
+          TOOLCHAIN_NAME=$(ls bin/targets/${{inputs.target }}/${{ inputs.subtarget }} | grep toolchain)
+          echo "toolchain-name=$TOOLCHAIN_NAME" >> $GITHUB_OUTPUT
+
+      - name: Upload prebuilt toolchain
+        if: inputs.upload_external_toolchain == true
+        uses: actions/upload-artifact@v3
+        with:
+          name: ${{ inputs.target }}-${{ inputs.subtarget }}-external-toolchain
+          path: openwrt/bin/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ steps.get-toolchain-name.outputs.toolchain-name }}
+          retention-days: 1