[openwrt/openwrt] CI: use buildbot container for building

LEDE Commits lede-commits at lists.infradead.org
Sun Dec 4 07:37:23 PST 2022


ansuel pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/6f9067e9d472c7cbda4acb16da88313450302de8

commit 6f9067e9d472c7cbda4acb16da88313450302de8
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Sun Mar 20 20:02:08 2022 +0000

    CI: use buildbot container for building
    
    Instead of using a fresh Linux installation which is setup every time
    use the Buildbot container which is used for our own Buildbot
    infrastructure, too.
    While at it also tidy up the workflow to make it more consistent with
    other workflow.
    
    Signed-off-by: Paul Spooren <mail at aparcar.org>
    Co-Developed-by: Christian Marangi <ansuelsmth at gmail.com>
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
    (cherry picked from commit 3b23227d43ec720f810e6e261945530f7bc549f0)
---
 .github/workflows/tools.yml | 117 +++++++++++++++++++-------------------------
 1 file changed, 50 insertions(+), 67 deletions(-)

diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml
index b97f0599e2..52999758cf 100644
--- a/.github/workflows/tools.yml
+++ b/.github/workflows/tools.yml
@@ -10,31 +10,25 @@ permissions:
   contents: read
 
 jobs:
-  build:
-    name: tools-${{ matrix.os }}
-    runs-on: ${{ matrix.os }}
-    strategy:
-      fail-fast: False
-      matrix:
-        os: 
-          - ubuntu-latest
-          - macos-latest
+  build-macos-latest:
+    runs-on: macos-latest
+
     steps:
       - name: Checkout
         uses: actions/checkout at v2
         with:
-          fetch-depth: 0
           path: openwrt
 
       - name: Setup MacOS
-        if: ${{ matrix.os == 'macos-latest' }}
         run: |
-          echo "WORKPATH=/Volumes/OpenWrt/openwrt/" >> "$GITHUB_ENV"
+          echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV"
           hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
           hdiutil attach OpenWrt.sparseimage
           mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/
-          cd "$WORKPATH"
 
+      - name: Install required prereq on MacOS
+        working-directory: ${{ env.WORKPATH }}/openwrt
+        run: |
           brew install \
             autoconf \
             automake \
@@ -74,74 +68,63 @@ jobs:
             echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
             echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
             echo "/usr/sbin" >> "$GITHUB_PATH"
-            pwd
-
-      - name: Setup Ubuntu
-        if: ${{ matrix.os == 'ubuntu-latest' }}
-        env:
-          DEBIAN_FRONTEND: noninteractive
-        run: |
-          sudo apt-get update
-          sudo apt-get -y install \
-            build-essential \
-            ccache \
-            clang-12 \
-            ecj \
-            fastjar \
-            file \
-            g++ \
-            gawk \
-            gettext \
-            git \
-            java-propose-classpath \
-            libelf-dev \
-            libncurses-dev \
-            libssl-dev \
-            mkisofs \
-            python3 \
-            python3-dev \
-            python3-distutils \
-            python3-setuptools \
-            qemu-utils \
-            rsync \
-            subversion \
-            swig \
-            unzip \
-            wget \
-            xsltproc \
-            zlib1g-dev
-          echo "WORKPATH=$GITHUB_WORKSPACE/openwrt/" >> "$GITHUB_ENV"
-          cd "$WORKPATH"
-          pwd
 
       - name: Make prereq
-        run: |
-          cd "$WORKPATH"
-          pwd
-          make defconfig
+        working-directory: ${{ env.WORKPATH }}/openwrt
+        run: make defconfig
 
-      - name: Build tools
-        run: |
-          cd "$WORKPATH"
-          make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
+      - name: Build tools MacOS
+        working-directory: ${{ env.WORKPATH }}/openwrt
+        run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
+
+      - name: Upload logs
+        if: always()
+        uses: actions/upload-artifact at v2
+        with:
+          name: macos-latest-logs
+          path: ${{ env.WORKPATH }}/openwrt/logs
 
-      - name: Move logs to GITHUB_WORKSPACE
+      - name: Upload config
         if: always()
+        uses: actions/upload-artifact at v2
+        with:
+          name: macos-latest-config
+          path: ${{ env.WORKPATH }}/openwrt/.config
+
+  build-linux-buildbot:
+    runs-on: ubuntu-latest
+    container: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout at v2
+        with:
+          path: 'openwrt'
+
+      - name: Fix permission
         run: |
-          cp -r "$WORKPATH/logs" "$GITHUB_WORKSPACE"
-          cp -r "$WORKPATH/.config" "$GITHUB_WORKSPACE/config"
+          chown -R buildbot:buildbot openwrt
+
+      - name: Make prereq
+        shell: su buildbot -c "sh -e {0}"
+        working-directory: openwrt
+        run: make defconfig
 
+      - name: Build tools BuildBot Container
+        shell: su buildbot -c "sh -e {0}"
+        working-directory: openwrt
+        run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
 
       - name: Upload logs
         if: always()
         uses: actions/upload-artifact at v2
         with:
-          name: ${{ matrix.os }}-logs
-          path: "logs"
+          name: linux-buildbot-logs
+          path: openwrt/logs
 
       - name: Upload config
         if: always()
         uses: actions/upload-artifact at v2
         with:
-          name: ${{ matrix.os }}-config
-          path: "config"
+          name: linux-buildbot-config
+          path: openwrt/.config




More information about the lede-commits mailing list