From 39f747569c215ba34cda8d1d7f8c7e0c089aac4e Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Wed, 31 Aug 2022 22:19:39 +0800 Subject: [PATCH] =?UTF-8?q?workflows:=20=E6=B7=BB=E5=8A=A0=20cache=20?= =?UTF-8?q?=E5=8A=A0=E9=80=9F=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to klever1988/cachewrtbuild --- .../workflows/AutoBuild-asus_rt-acrh17.yml | 79 ++++++++++++------- .../workflows/AutoBuild-d-team_newifi-d2.yml | 79 ++++++++++++------- .../workflows/AutoBuild-p2w_r619ac-128m.yml | 79 ++++++++++++------- .github/workflows/AutoBuild-x86_64.yml | 79 ++++++++++++------- .../AutoBuild-xiaomi_redmi-router-ac2100.yml | 79 ++++++++++++------- .../AutoBuild-xiaomi_redmi-router-ax6s.yml | 79 ++++++++++++------- .github/workflows/AutoBuild-xiaoyu_xy-c5.yml | 79 ++++++++++++------- 7 files changed, 350 insertions(+), 203 deletions(-) diff --git a/.github/workflows/AutoBuild-asus_rt-acrh17.yml b/.github/workflows/AutoBuild-asus_rt-acrh17.yml index 143e0bb..3029d55 100644 --- a/.github/workflows/AutoBuild-asus_rt-acrh17.yml +++ b/.github/workflows/AutoBuild-asus_rt-acrh17.yml @@ -48,11 +48,13 @@ env: DELETE_USELESS_FILES: true # 删除早期的 workflow 任务 DELETE_OLD_WORKFLOW: false +# Cache 加速编译 + CACHE_ACCELERATE: true ### 结束 jobs: Compile: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 permissions: issues: write pull-requests: write @@ -60,17 +62,21 @@ jobs: steps: - name: Maximize Build Space + if: env.DELETE_USELESS_FILES == 'true' && !cancelled() uses: easimon/maximize-build-space@master with: root-reserve-mb: 5120 swap-size-mb: 512 remove-dotnet: 'true' remove-android: 'true' + remove-haskell: 'true' - name: Checkout uses: actions/checkout@main + with: + fetch-depth: 0 - - name: Initialization Variables + - name: Load Custom Variables run: | echo "Free space:" df -h @@ -87,7 +93,7 @@ jobs: fi if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ] then - echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !" + echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..." exit 1 else echo "CONFIG_FILE: [/Config/$CONFIG_FILE]" @@ -102,17 +108,15 @@ jobs: then echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]" echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV - else - echo "env Tempoary_FLAG is not detected !" fi - REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)" - REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2) + REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})" + REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }}) echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV - - name: Initialization Environment + - name: Initialize Environment env: DEBIAN_FRONTEND: noninteractive run: | @@ -137,32 +141,49 @@ jobs: ./scripts/feeds update -a ./scripts/feeds install -a - - name: Run AutoBuild_DiyScript.sh + - name: Accelerate + if: env.CACHE_ACCELERATE == 'true' + uses: klever1988/cachewrtbuild@main + with: + ccache: false + toolchain: true + skip: true + clean: false + prefix: ${{ github.workspace }}/openwrt + + - name: Run Diy Scripts run: | chmod +x Scripts/AutoBuild_*.sh - cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config cd openwrt - make defconfig + if [ "${{ env.CACHE_ACCELERATE }}" == true ] + then + echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE + fi + cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh + make defconfig Firmware_Diy_Before - rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config + rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config Firmware_Diy_Main Firmware_Diy + Firmware_Diy_Other - - name: Compile + - name: Pre-download Libraries run: | cd openwrt - source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh - Firmware_Diy_Other - ./scripts/feeds install -a > /dev/null 2>&1 + ./scripts/feeds install -a make defconfig - make download -j$(nproc) V=s - make -j$(nproc) || make -j1 V=s - [ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV + make download -j8 - - name: Process Firmware - if: env.Result == 'true' && !cancelled() + - name: Build OpenWrt + run: | + cd openwrt + make -j$(nproc) || make -j1 V=s + [ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV + + - name: Checkout Firmware + if: env.Compile_Result == 'true' && !cancelled() run: | cd openwrt source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh @@ -170,21 +191,21 @@ jobs: - name: Upload Firmware to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }} path: openwrt/bin/Firmware - name: Upload bin to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }} path: openwrt/bin - - name: Upload Firmware to Github Release + - name: Upload Firmware to Release uses: svenstaro/upload-release-action@v2 - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: openwrt/bin/Firmware/* @@ -192,13 +213,13 @@ jobs: tag: AutoUpdate overwrite: true - - name: Download Github Release API - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Download Github API + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() run: | wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API - - name: Upload API to Github Release - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Upload Github API to Release + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/AutoBuild-d-team_newifi-d2.yml b/.github/workflows/AutoBuild-d-team_newifi-d2.yml index b456634..8266691 100644 --- a/.github/workflows/AutoBuild-d-team_newifi-d2.yml +++ b/.github/workflows/AutoBuild-d-team_newifi-d2.yml @@ -48,11 +48,13 @@ env: DELETE_USELESS_FILES: true # 删除早期的 workflow 任务 DELETE_OLD_WORKFLOW: false +# Cache 加速编译 + CACHE_ACCELERATE: true ### 结束 jobs: Compile: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 permissions: issues: write pull-requests: write @@ -60,17 +62,21 @@ jobs: steps: - name: Maximize Build Space + if: env.DELETE_USELESS_FILES == 'true' && !cancelled() uses: easimon/maximize-build-space@master with: root-reserve-mb: 5120 swap-size-mb: 512 remove-dotnet: 'true' remove-android: 'true' + remove-haskell: 'true' - name: Checkout uses: actions/checkout@main + with: + fetch-depth: 0 - - name: Initialization Variables + - name: Load Custom Variables run: | echo "Free space:" df -h @@ -87,7 +93,7 @@ jobs: fi if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ] then - echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !" + echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..." exit 1 else echo "CONFIG_FILE: [/Config/$CONFIG_FILE]" @@ -102,17 +108,15 @@ jobs: then echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]" echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV - else - echo "env Tempoary_FLAG is not detected !" fi - REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)" - REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2) + REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})" + REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }}) echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV - - name: Initialization Environment + - name: Initialize Environment env: DEBIAN_FRONTEND: noninteractive run: | @@ -137,32 +141,49 @@ jobs: ./scripts/feeds update -a ./scripts/feeds install -a - - name: Run AutoBuild_DiyScript.sh + - name: Accelerate + if: env.CACHE_ACCELERATE == 'true' + uses: klever1988/cachewrtbuild@main + with: + ccache: false + toolchain: true + skip: true + clean: false + prefix: ${{ github.workspace }}/openwrt + + - name: Run Diy Scripts run: | chmod +x Scripts/AutoBuild_*.sh - cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config cd openwrt - make defconfig + if [ "${{ env.CACHE_ACCELERATE }}" == true ] + then + echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE + fi + cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh + make defconfig Firmware_Diy_Before - rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config + rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config Firmware_Diy_Main Firmware_Diy + Firmware_Diy_Other - - name: Compile + - name: Pre-download Libraries run: | cd openwrt - source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh - Firmware_Diy_Other - ./scripts/feeds install -a > /dev/null 2>&1 + ./scripts/feeds install -a make defconfig - make download -j$(nproc) V=s - make -j$(nproc) || make -j1 V=s - [ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV + make download -j8 - - name: Process Firmware - if: env.Result == 'true' && !cancelled() + - name: Build OpenWrt + run: | + cd openwrt + make -j$(nproc) || make -j1 V=s + [ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV + + - name: Checkout Firmware + if: env.Compile_Result == 'true' && !cancelled() run: | cd openwrt source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh @@ -170,21 +191,21 @@ jobs: - name: Upload Firmware to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }} path: openwrt/bin/Firmware - name: Upload bin to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }} path: openwrt/bin - - name: Upload Firmware to Github Release + - name: Upload Firmware to Release uses: svenstaro/upload-release-action@v2 - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: openwrt/bin/Firmware/* @@ -192,13 +213,13 @@ jobs: tag: AutoUpdate overwrite: true - - name: Download Github Release API - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Download Github API + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() run: | wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API - - name: Upload API to Github Release - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Upload Github API to Release + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/AutoBuild-p2w_r619ac-128m.yml b/.github/workflows/AutoBuild-p2w_r619ac-128m.yml index d1e1f96..82cc7a9 100644 --- a/.github/workflows/AutoBuild-p2w_r619ac-128m.yml +++ b/.github/workflows/AutoBuild-p2w_r619ac-128m.yml @@ -48,11 +48,13 @@ env: DELETE_USELESS_FILES: true # 删除早期的 workflow 任务 DELETE_OLD_WORKFLOW: false +# Cache 加速编译 + CACHE_ACCELERATE: true ### 结束 jobs: Compile: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 permissions: issues: write pull-requests: write @@ -60,17 +62,21 @@ jobs: steps: - name: Maximize Build Space + if: env.DELETE_USELESS_FILES == 'true' && !cancelled() uses: easimon/maximize-build-space@master with: root-reserve-mb: 5120 swap-size-mb: 512 remove-dotnet: 'true' remove-android: 'true' + remove-haskell: 'true' - name: Checkout uses: actions/checkout@main + with: + fetch-depth: 0 - - name: Initialization Variables + - name: Load Custom Variables run: | echo "Free space:" df -h @@ -87,7 +93,7 @@ jobs: fi if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ] then - echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !" + echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..." exit 1 else echo "CONFIG_FILE: [/Config/$CONFIG_FILE]" @@ -102,17 +108,15 @@ jobs: then echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]" echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV - else - echo "env Tempoary_FLAG is not detected !" fi - REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)" - REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2) + REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})" + REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }}) echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV - - name: Initialization Environment + - name: Initialize Environment env: DEBIAN_FRONTEND: noninteractive run: | @@ -137,32 +141,49 @@ jobs: ./scripts/feeds update -a ./scripts/feeds install -a - - name: Run AutoBuild_DiyScript.sh + - name: Accelerate + if: env.CACHE_ACCELERATE == 'true' + uses: klever1988/cachewrtbuild@main + with: + ccache: false + toolchain: true + skip: true + clean: false + prefix: ${{ github.workspace }}/openwrt + + - name: Run Diy Scripts run: | chmod +x Scripts/AutoBuild_*.sh - cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config cd openwrt - make defconfig + if [ "${{ env.CACHE_ACCELERATE }}" == true ] + then + echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE + fi + cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh + make defconfig Firmware_Diy_Before - rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config + rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config Firmware_Diy_Main Firmware_Diy + Firmware_Diy_Other - - name: Compile + - name: Pre-download Libraries run: | cd openwrt - source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh - Firmware_Diy_Other - ./scripts/feeds install -a > /dev/null 2>&1 + ./scripts/feeds install -a make defconfig - make download -j$(nproc) V=s - make -j$(nproc) || make -j1 V=s - [ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV + make download -j8 - - name: Process Firmware - if: env.Result == 'true' && !cancelled() + - name: Build OpenWrt + run: | + cd openwrt + make -j$(nproc) || make -j1 V=s + [ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV + + - name: Checkout Firmware + if: env.Compile_Result == 'true' && !cancelled() run: | cd openwrt source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh @@ -170,21 +191,21 @@ jobs: - name: Upload Firmware to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }} path: openwrt/bin/Firmware - name: Upload bin to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }} path: openwrt/bin - - name: Upload Firmware to Github Release + - name: Upload Firmware to Release uses: svenstaro/upload-release-action@v2 - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: openwrt/bin/Firmware/* @@ -192,13 +213,13 @@ jobs: tag: AutoUpdate overwrite: true - - name: Download Github Release API - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Download Github API + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() run: | wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API - - name: Upload API to Github Release - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Upload Github API to Release + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/AutoBuild-x86_64.yml b/.github/workflows/AutoBuild-x86_64.yml index 258f9cf..0874e2b 100644 --- a/.github/workflows/AutoBuild-x86_64.yml +++ b/.github/workflows/AutoBuild-x86_64.yml @@ -48,11 +48,13 @@ env: DELETE_USELESS_FILES: true # 删除早期的 workflow 任务 DELETE_OLD_WORKFLOW: false +# Cache 加速编译 + CACHE_ACCELERATE: true ### 结束 jobs: Compile: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 permissions: issues: write pull-requests: write @@ -60,17 +62,21 @@ jobs: steps: - name: Maximize Build Space + if: env.DELETE_USELESS_FILES == 'true' && !cancelled() uses: easimon/maximize-build-space@master with: root-reserve-mb: 5120 swap-size-mb: 512 remove-dotnet: 'true' remove-android: 'true' + remove-haskell: 'true' - name: Checkout uses: actions/checkout@main + with: + fetch-depth: 0 - - name: Initialization Variables + - name: Load Custom Variables run: | echo "Free space:" df -h @@ -87,7 +93,7 @@ jobs: fi if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ] then - echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !" + echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..." exit 1 else echo "CONFIG_FILE: [/Config/$CONFIG_FILE]" @@ -102,17 +108,15 @@ jobs: then echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]" echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV - else - echo "env Tempoary_FLAG is not detected !" fi - REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)" - REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2) + REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})" + REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }}) echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV - - name: Initialization Environment + - name: Initialize Environment env: DEBIAN_FRONTEND: noninteractive run: | @@ -137,32 +141,49 @@ jobs: ./scripts/feeds update -a ./scripts/feeds install -a - - name: Run AutoBuild_DiyScript.sh + - name: Accelerate + if: env.CACHE_ACCELERATE == 'true' + uses: klever1988/cachewrtbuild@main + with: + ccache: false + toolchain: true + skip: true + clean: false + prefix: ${{ github.workspace }}/openwrt + + - name: Run Diy Scripts run: | chmod +x Scripts/AutoBuild_*.sh - cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config cd openwrt - make defconfig + if [ "${{ env.CACHE_ACCELERATE }}" == true ] + then + echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE + fi + cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh + make defconfig Firmware_Diy_Before - rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config + rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config Firmware_Diy_Main Firmware_Diy + Firmware_Diy_Other - - name: Compile + - name: Pre-download Libraries run: | cd openwrt - source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh - Firmware_Diy_Other - ./scripts/feeds install -a > /dev/null 2>&1 + ./scripts/feeds install -a make defconfig - make download -j$(nproc) V=s - make -j$(nproc) || make -j1 V=s - [ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV + make download -j8 - - name: Process Firmware - if: env.Result == 'true' && !cancelled() + - name: Build OpenWrt + run: | + cd openwrt + make -j$(nproc) || make -j1 V=s + [ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV + + - name: Checkout Firmware + if: env.Compile_Result == 'true' && !cancelled() run: | cd openwrt source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh @@ -170,21 +191,21 @@ jobs: - name: Upload Firmware to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }} path: openwrt/bin/Firmware - name: Upload bin to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }} path: openwrt/bin - - name: Upload Firmware to Github Release + - name: Upload Firmware to Release uses: svenstaro/upload-release-action@v2 - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: openwrt/bin/Firmware/* @@ -192,13 +213,13 @@ jobs: tag: AutoUpdate overwrite: true - - name: Download Github Release API - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Download Github API + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() run: | wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API - - name: Upload API to Github Release - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Upload Github API to Release + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/AutoBuild-xiaomi_redmi-router-ac2100.yml b/.github/workflows/AutoBuild-xiaomi_redmi-router-ac2100.yml index 889e0ab..e3d20a6 100644 --- a/.github/workflows/AutoBuild-xiaomi_redmi-router-ac2100.yml +++ b/.github/workflows/AutoBuild-xiaomi_redmi-router-ac2100.yml @@ -48,11 +48,13 @@ env: DELETE_USELESS_FILES: true # 删除早期的 workflow 任务 DELETE_OLD_WORKFLOW: false +# Cache 加速编译 + CACHE_ACCELERATE: true ### 结束 jobs: Compile: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 permissions: issues: write pull-requests: write @@ -60,17 +62,21 @@ jobs: steps: - name: Maximize Build Space + if: env.DELETE_USELESS_FILES == 'true' && !cancelled() uses: easimon/maximize-build-space@master with: root-reserve-mb: 5120 swap-size-mb: 512 remove-dotnet: 'true' remove-android: 'true' + remove-haskell: 'true' - name: Checkout uses: actions/checkout@main + with: + fetch-depth: 0 - - name: Initialization Variables + - name: Load Custom Variables run: | echo "Free space:" df -h @@ -87,7 +93,7 @@ jobs: fi if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ] then - echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !" + echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..." exit 1 else echo "CONFIG_FILE: [/Config/$CONFIG_FILE]" @@ -102,17 +108,15 @@ jobs: then echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]" echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV - else - echo "env Tempoary_FLAG is not detected !" fi - REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)" - REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2) + REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})" + REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }}) echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV - - name: Initialization Environment + - name: Initialize Environment env: DEBIAN_FRONTEND: noninteractive run: | @@ -137,32 +141,49 @@ jobs: ./scripts/feeds update -a ./scripts/feeds install -a - - name: Run AutoBuild_DiyScript.sh + - name: Accelerate + if: env.CACHE_ACCELERATE == 'true' + uses: klever1988/cachewrtbuild@main + with: + ccache: false + toolchain: true + skip: true + clean: false + prefix: ${{ github.workspace }}/openwrt + + - name: Run Diy Scripts run: | chmod +x Scripts/AutoBuild_*.sh - cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config cd openwrt - make defconfig + if [ "${{ env.CACHE_ACCELERATE }}" == true ] + then + echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE + fi + cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh + make defconfig Firmware_Diy_Before - rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config + rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config Firmware_Diy_Main Firmware_Diy + Firmware_Diy_Other - - name: Compile + - name: Pre-download Libraries run: | cd openwrt - source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh - Firmware_Diy_Other - ./scripts/feeds install -a > /dev/null 2>&1 + ./scripts/feeds install -a make defconfig - make download -j$(nproc) V=s - make -j$(nproc) || make -j1 V=s - [ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV + make download -j8 - - name: Process Firmware - if: env.Result == 'true' && !cancelled() + - name: Build OpenWrt + run: | + cd openwrt + make -j$(nproc) || make -j1 V=s + [ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV + + - name: Checkout Firmware + if: env.Compile_Result == 'true' && !cancelled() run: | cd openwrt source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh @@ -170,21 +191,21 @@ jobs: - name: Upload Firmware to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }} path: openwrt/bin/Firmware - name: Upload bin to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }} path: openwrt/bin - - name: Upload Firmware to Github Release + - name: Upload Firmware to Release uses: svenstaro/upload-release-action@v2 - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: openwrt/bin/Firmware/* @@ -192,13 +213,13 @@ jobs: tag: AutoUpdate overwrite: true - - name: Download Github Release API - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Download Github API + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() run: | wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API - - name: Upload API to Github Release - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Upload Github API to Release + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/AutoBuild-xiaomi_redmi-router-ax6s.yml b/.github/workflows/AutoBuild-xiaomi_redmi-router-ax6s.yml index 02b61b0..9b46b54 100644 --- a/.github/workflows/AutoBuild-xiaomi_redmi-router-ax6s.yml +++ b/.github/workflows/AutoBuild-xiaomi_redmi-router-ax6s.yml @@ -48,11 +48,13 @@ env: DELETE_USELESS_FILES: true # 删除早期的 workflow 任务 DELETE_OLD_WORKFLOW: false +# Cache 加速编译 + CACHE_ACCELERATE: true ### 结束 jobs: Compile: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 permissions: issues: write pull-requests: write @@ -60,17 +62,21 @@ jobs: steps: - name: Maximize Build Space + if: env.DELETE_USELESS_FILES == 'true' && !cancelled() uses: easimon/maximize-build-space@master with: root-reserve-mb: 5120 swap-size-mb: 512 remove-dotnet: 'true' remove-android: 'true' + remove-haskell: 'true' - name: Checkout uses: actions/checkout@main + with: + fetch-depth: 0 - - name: Initialization Variables + - name: Load Custom Variables run: | echo "Free space:" df -h @@ -87,7 +93,7 @@ jobs: fi if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ] then - echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !" + echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..." exit 1 else echo "CONFIG_FILE: [/Config/$CONFIG_FILE]" @@ -102,17 +108,15 @@ jobs: then echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]" echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV - else - echo "env Tempoary_FLAG is not detected !" fi - REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)" - REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2) + REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})" + REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }}) echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV - - name: Initialization Environment + - name: Initialize Environment env: DEBIAN_FRONTEND: noninteractive run: | @@ -137,32 +141,49 @@ jobs: ./scripts/feeds update -a ./scripts/feeds install -a - - name: Run AutoBuild_DiyScript.sh + - name: Accelerate + if: env.CACHE_ACCELERATE == 'true' + uses: klever1988/cachewrtbuild@main + with: + ccache: false + toolchain: true + skip: true + clean: false + prefix: ${{ github.workspace }}/openwrt + + - name: Run Diy Scripts run: | chmod +x Scripts/AutoBuild_*.sh - cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config cd openwrt - make defconfig + if [ "${{ env.CACHE_ACCELERATE }}" == true ] + then + echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE + fi + cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh + make defconfig Firmware_Diy_Before - rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config + rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config Firmware_Diy_Main Firmware_Diy + Firmware_Diy_Other - - name: Compile + - name: Pre-download Libraries run: | cd openwrt - source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh - Firmware_Diy_Other - ./scripts/feeds install -a > /dev/null 2>&1 + ./scripts/feeds install -a make defconfig - make download -j$(nproc) V=s - make -j$(nproc) || make -j1 V=s - [ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV + make download -j8 - - name: Process Firmware - if: env.Result == 'true' && !cancelled() + - name: Build OpenWrt + run: | + cd openwrt + make -j$(nproc) || make -j1 V=s + [ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV + + - name: Checkout Firmware + if: env.Compile_Result == 'true' && !cancelled() run: | cd openwrt source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh @@ -170,21 +191,21 @@ jobs: - name: Upload Firmware to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }} path: openwrt/bin/Firmware - name: Upload bin to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }} path: openwrt/bin - - name: Upload Firmware to Github Release + - name: Upload Firmware to Release uses: svenstaro/upload-release-action@v2 - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: openwrt/bin/Firmware/* @@ -192,13 +213,13 @@ jobs: tag: AutoUpdate overwrite: true - - name: Download Github Release API - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Download Github API + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() run: | wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API - - name: Upload API to Github Release - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Upload Github API to Release + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/AutoBuild-xiaoyu_xy-c5.yml b/.github/workflows/AutoBuild-xiaoyu_xy-c5.yml index fffa52b..26908b7 100644 --- a/.github/workflows/AutoBuild-xiaoyu_xy-c5.yml +++ b/.github/workflows/AutoBuild-xiaoyu_xy-c5.yml @@ -48,11 +48,13 @@ env: DELETE_USELESS_FILES: true # 删除早期的 workflow 任务 DELETE_OLD_WORKFLOW: false +# Cache 加速编译 + CACHE_ACCELERATE: true ### 结束 jobs: Compile: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 permissions: issues: write pull-requests: write @@ -60,17 +62,21 @@ jobs: steps: - name: Maximize Build Space + if: env.DELETE_USELESS_FILES == 'true' && !cancelled() uses: easimon/maximize-build-space@master with: root-reserve-mb: 5120 swap-size-mb: 512 remove-dotnet: 'true' remove-android: 'true' + remove-haskell: 'true' - name: Checkout uses: actions/checkout@main + with: + fetch-depth: 0 - - name: Initialization Variables + - name: Load Custom Variables run: | echo "Free space:" df -h @@ -87,7 +93,7 @@ jobs: fi if [ ! -f "$GITHUB_WORKSPACE/Configs/$CONFIG_FILE" ] then - echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected !" + echo "CONFIG_FILE: [/Config/$CONFIG_FILE] is not detected ..." exit 1 else echo "CONFIG_FILE: [/Config/$CONFIG_FILE]" @@ -102,17 +108,15 @@ jobs: then echo "FLAG: [${{ github.event.inputs.Tempoary_FLAG }}]" echo "Tempoary_FLAG=${{ github.event.inputs.Tempoary_FLAG }}" >> $GITHUB_ENV - else - echo "env Tempoary_FLAG is not detected !" fi - REPO_URL="https://github.com/$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 1)" - REPO_BRANCH=$(echo ${{ env.DEFAULT_SOURCE }} | cut -d \: -f 2) + REPO_URL="https://github.com/$(cut -d \: -f 1 <<< ${{ env.DEFAULT_SOURCE }})" + REPO_BRANCH=$(cut -d \: -f 2 <<< ${{ env.DEFAULT_SOURCE }}) echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV echo "Compile_Date=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV echo "Display_Date=$(date +%Y/%m/%d)" >> $GITHUB_ENV - - name: Initialization Environment + - name: Initialize Environment env: DEBIAN_FRONTEND: noninteractive run: | @@ -137,32 +141,49 @@ jobs: ./scripts/feeds update -a ./scripts/feeds install -a - - name: Run AutoBuild_DiyScript.sh + - name: Accelerate + if: env.CACHE_ACCELERATE == 'true' + uses: klever1988/cachewrtbuild@main + with: + ccache: false + toolchain: true + skip: true + clean: false + prefix: ${{ github.workspace }}/openwrt + + - name: Run Diy Scripts run: | chmod +x Scripts/AutoBuild_*.sh - cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE openwrt/.config cd openwrt - make defconfig + if [ "${{ env.CACHE_ACCELERATE }}" == true ] + then + echo -e "\nCONFIG_DEVEL=y\nCONFIG_CCACHE=y\n" >> $GITHUB_WORKSPACE/Configs/$CONFIG_FILE + fi + cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config source $GITHUB_WORKSPACE/Scripts/AutoBuild_DiyScript.sh source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh + make defconfig Firmware_Diy_Before - rm .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config + rm -f .config && cp $GITHUB_WORKSPACE/Configs/$CONFIG_FILE .config Firmware_Diy_Main Firmware_Diy + Firmware_Diy_Other - - name: Compile + - name: Pre-download Libraries run: | cd openwrt - source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh - Firmware_Diy_Other - ./scripts/feeds install -a > /dev/null 2>&1 + ./scripts/feeds install -a make defconfig - make download -j$(nproc) V=s - make -j$(nproc) || make -j1 V=s - [ $? == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV + make download -j8 - - name: Process Firmware - if: env.Result == 'true' && !cancelled() + - name: Build OpenWrt + run: | + cd openwrt + make -j$(nproc) || make -j1 V=s + [ "$?" == 0 ] && echo "Compile_Result=true" >> $GITHUB_ENV || echo "Compile_Result=false" >> $GITHUB_ENV + + - name: Checkout Firmware + if: env.Compile_Result == 'true' && !cancelled() run: | cd openwrt source $GITHUB_WORKSPACE/Scripts/AutoBuild_Function.sh @@ -170,21 +191,21 @@ jobs: - name: Upload Firmware to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_firmware_${{ env.Compile_Date }} path: openwrt/bin/Firmware - name: Upload bin to Artifacts uses: actions/upload-artifact@main - if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_BIN_ARTIFACTS == 'true' && env.Compile_Result == 'true' && !cancelled() with: name: ${{ env.CONFIG_FILE }}_bin_${{ env.Compile_Date }} path: openwrt/bin - - name: Upload Firmware to Github Release + - name: Upload Firmware to Release uses: svenstaro/upload-release-action@v2 - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: openwrt/bin/Firmware/* @@ -192,13 +213,13 @@ jobs: tag: AutoUpdate overwrite: true - - name: Download Github Release API - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Download Github API + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() run: | wget https://api.github.com/repos/${{github.repository}}/releases/tags/AutoUpdate -O API - - name: Upload API to Github Release - if: env.UPLOAD_RELEASES == 'true' && env.Result == 'true' && !cancelled() + - name: Upload Github API to Release + if: env.UPLOAD_RELEASES == 'true' && env.Compile_Result == 'true' && !cancelled() uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }}