|
| 1 | +name: Build standard |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + repository_dispatch: |
| 6 | + types: [std] |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build ${{ matrix.model }}-${{ matrix.tag.version }} |
| 11 | + runs-on: ubuntu-24.04 |
| 12 | + defaults: |
| 13 | + run: |
| 14 | + shell: bash |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + model: |
| 19 | + - armv8 |
| 20 | + - nanopi-r4s |
| 21 | + - nanopi-r5s |
| 22 | + - nanopi-r76s |
| 23 | + - x86_64 |
| 24 | + tag: |
| 25 | + - type: rc2 |
| 26 | + version: openwrt-25.12 |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Setup variables |
| 30 | + run: | |
| 31 | + sudo timedatectl set-timezone 'Asia/Shanghai' |
| 32 | + git config --global user.name 'actions' |
| 33 | + git config --global user.email 'action@github.com' |
| 34 | + echo build_dir="/builder" >> "$GITHUB_ENV" |
| 35 | + if [[ "${{ matrix.model }}" == nanopi-* ]]; then |
| 36 | + echo ccache_model=nanopi-r5s >> "$GITHUB_ENV" |
| 37 | + else |
| 38 | + echo ccache_model=${{ matrix.model }} >> "$GITHUB_ENV" |
| 39 | + fi |
| 40 | +
|
| 41 | + - name: Show system |
| 42 | + run: | |
| 43 | + echo -e "\n\e[1;32mCPU:\e[0m" |
| 44 | + echo "$(grep 'model name' /proc/cpuinfo | head -1 | awk -F ': ' '{print $2}') ($(grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F ': ' '{print $2}')MHz) x $(grep processor /proc/cpuinfo | wc -l)" |
| 45 | + echo -e "\n\e[1;32mMemory:\e[0m" |
| 46 | + free -h |
| 47 | + echo -e "\n\e[1;32mStorage:\e[0m" |
| 48 | + df -Th / /mnt |
| 49 | + echo -e "\n\e[1;32mSystem:\e[0m" |
| 50 | + lsb_release -a |
| 51 | + echo -e "\n\e[1;32mKernel:\e[0m" |
| 52 | + uname -a |
| 53 | + echo |
| 54 | +
|
| 55 | + - name: Free disk space |
| 56 | + uses: sbwml/actions@free-disk |
| 57 | + with: |
| 58 | + build-mount-path: /builder |
| 59 | + |
| 60 | + - name: Build System Setup |
| 61 | + uses: sbwml/actions@openwrt-build-setup |
| 62 | + |
| 63 | + - name: Install LLVM |
| 64 | + uses: sbwml/actions@install-llvm |
| 65 | + |
| 66 | + - name: Restore Cached |
| 67 | + uses: actions/cache/restore@v5 |
| 68 | + with: |
| 69 | + path: /builder/.ccache |
| 70 | + key: ${{ matrix.tag.version }}-${{ env.ccache_model }} |
| 71 | + |
| 72 | + - name: Compile OpenWrt |
| 73 | + id: compile |
| 74 | + continue-on-error: true |
| 75 | + working-directory: /builder |
| 76 | + env: |
| 77 | + git_name: private |
| 78 | + git_password: ${{ secrets.ftp_password }} |
| 79 | + private_url: ${{ secrets.private_url }} |
| 80 | + run: | |
| 81 | + export KERNEL_CLANG_LTO=y BUILD_FAST=y ENABLE_CCACHE=y ENABLE_BPF=y ENABLE_LTO=y ENABLE_LRNG=y STD_BUILD=y USE_GCC15=y ENABLE_MOLD=y |
| 82 | + bash <(curl -sS ${{ secrets.script_url_general }}) ${{ matrix.tag.type }} ${{ matrix.model }} |
| 83 | + cd openwrt |
| 84 | + tags=$(git describe --abbrev=0 --tags) |
| 85 | + echo "latest_release=$tags" >>$GITHUB_ENV |
| 86 | +
|
| 87 | + - name: Extensive logs after a failed compilation |
| 88 | + if: steps.compile.outcome == 'failure' |
| 89 | + working-directory: /builder |
| 90 | + run: | |
| 91 | + cd openwrt |
| 92 | + make V=s IGNORE_ERRORS="n m" |
| 93 | +
|
| 94 | + - name: Prepare Firmware Files |
| 95 | + working-directory: /builder |
| 96 | + run: | |
| 97 | + mkdir -p rom info |
| 98 | + if [ "${{ matrix.model }}" = "nanopi-r4s" ]; then |
| 99 | + cp -a openwrt/bin/targets/rockchip/*/*.img.gz rom/ |
| 100 | + cp -a openwrt/bin/targets/rockchip/*/*-r4s.manifest info/manifest.txt |
| 101 | + cp -a openwrt/bin/targets/rockchip/*/config.buildinfo info/config.buildinfo |
| 102 | + cd rom && sha256sum * > ../info/sha256sums.txt |
| 103 | + elif [ "${{ matrix.model }}" = "nanopi-r5s" ]; then |
| 104 | + cp -a openwrt/bin/targets/rockchip/*/*.img.gz rom/ |
| 105 | + cp -a openwrt/bin/targets/rockchip/*/*.manifest info/manifest.txt |
| 106 | + cp -a openwrt/bin/targets/rockchip/*/config.buildinfo info/config.buildinfo |
| 107 | + cd rom && sha256sum * > ../info/sha256sums.txt |
| 108 | + elif [ "${{ matrix.model }}" = "nanopi-r76s" ]; then |
| 109 | + cp -a openwrt/bin/targets/rockchip/*/*.img.gz rom/ |
| 110 | + cp -a openwrt/bin/targets/rockchip/*/*.manifest info/manifest.txt |
| 111 | + cp -a openwrt/bin/targets/rockchip/*/config.buildinfo info/config.buildinfo |
| 112 | + cd rom && sha256sum * > ../info/sha256sums.txt |
| 113 | + elif [ "${{ matrix.model }}" = "x86_64" ]; then |
| 114 | + cp -a openwrt/bin/targets/x86/*/*-ext4-combined-efi.img.gz rom/ |
| 115 | + cp -a openwrt/bin/targets/x86/*/*-squashfs-combined-efi.img.gz rom/ |
| 116 | + cp -a openwrt/bin/targets/x86/*/*-generic-rootfs.tar.gz rom/ |
| 117 | + cp -a openwrt/bin/targets/x86/*/*-x86-64-generic.manifest info/manifest.txt |
| 118 | + cp -a openwrt/bin/targets/x86/*/config.buildinfo info/config.buildinfo |
| 119 | + cd rom && sha256sum * > ../info/sha256sums.txt |
| 120 | + elif [ "${{ matrix.model }}" = "armv8" ]; then |
| 121 | + tar zcf rom/u-boot-qemu_armv8.tar.gz -C openwrt/bin/targets/armsr/armv8*/ ./u-boot-qemu_armv8 |
| 122 | + cp -a openwrt/bin/targets/armsr/armv8*/*-generic-initramfs-kernel.bin rom/ |
| 123 | + cp -a openwrt/bin/targets/armsr/armv8*/*-generic-kernel.bin rom/ |
| 124 | + cp -a openwrt/bin/targets/armsr/armv8*/*-generic-ext4-combined-efi.img.gz rom/ |
| 125 | + cp -a openwrt/bin/targets/armsr/armv8*/*-generic-squashfs-combined-efi.img.gz rom/ |
| 126 | + cp -a openwrt/bin/targets/armsr/armv8*/*-rootfs.tar.gz rom/ |
| 127 | + cp -a openwrt/bin/targets/armsr/armv8*/*.manifest info/manifest.txt |
| 128 | + cp -a openwrt/bin/targets/armsr/armv8*/config.buildinfo info/config.buildinfo |
| 129 | + cd rom && sha256sum * > ../info/sha256sums.txt |
| 130 | + fi |
| 131 | + cd .. |
| 132 | + tar zcf rom/buildinfo_${{ matrix.model }}.tar.gz info |
| 133 | + echo '## Standard Version' > bodyFile |
| 134 | + echo '**This build does not include Docker. It comes with HomeProxy and a set of commonly used plugins, offering a balanced feature set with a moderate firmware size.**' >> bodyFile |
| 135 | +
|
| 136 | + - name: Create release |
| 137 | + uses: ncipollo/release-action@v1.20.0 |
| 138 | + with: |
| 139 | + name: OpenWrt-${{ env.latest_release }} Standard |
| 140 | + allowUpdates: true |
| 141 | + tag: ${{ env.latest_release }}-standard |
| 142 | + commit: main |
| 143 | + replacesArtifacts: true |
| 144 | + makeLatest: false |
| 145 | + token: ${{ secrets.workflow_token }} |
| 146 | + bodyFile: ${{ env.build_dir }}/bodyFile |
| 147 | + artifacts: | |
| 148 | + ${{ env.build_dir }}/rom/* |
0 commit comments