Build_redmi_ax6000 #70
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build_redmi_ax6000 | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: 0 8 * * 5 | |
| #release: | |
| # types: [published] | |
| #push: | |
| # branches: | |
| # - master | |
| #watch: | |
| # types: [started] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| #REPO_URL: https://github.com/openwrt/openwrt | |
| REPO_URL: https://github.com/coolsnowwolf/lede | |
| REPO_BRANCH: master | |
| CONFIG_FILE: 'redmi_ax6000.config' | |
| GITHUB_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@master | |
| - name: Initialization environment | |
| run: | | |
| set +e | |
| docker rmi $(docker images -q) | |
| echo "Deleting unnecessary files, please wait ..." | |
| sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php | |
| sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* | |
| sudo -E apt-get update | |
| sudo -E apt-get -y install \ | |
| build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip \ | |
| zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev \ | |
| texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler \ | |
| g++-multilib antlr3 gperf wget curl swig rsync aria2 ca-certificates python3-pyelftools python-pyelftools yasm libtinfo5 | |
| sudo -E apt-get -y autoremove --purge | |
| sudo -E apt-get clean | |
| - name: Echo host info | |
| run: | | |
| echo "-------------------------- CPU 信息 --------------------------" | |
| echo "CPU 物理数量: $(grep 'physical id' /proc/cpuinfo | sort -u | wc -l)" | |
| echo "CPU 核心数量: $(nproc)" | |
| echo "CPU 型号: $(grep -m1 'model name' /proc/cpuinfo | cut -d: -f2-)" | |
| echo "-------------------------- 内存信息 --------------------------" | |
| echo "已安装内存:" | |
| sudo lshw -short -C memory | grep GiB || true | |
| echo "-------------------------- 硬盘信息 --------------------------" | |
| echo "硬盘数量: $(ls /dev/sd* | grep -v [1-9] | wc -l)" | |
| df -hT | |
| - name: Clone source code | |
| run: | | |
| echo "DEV_NAME=_$(basename "$CONFIG_FILE" .config)" >> $GITHUB_ENV | |
| echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV | |
| git clone --depth 1 "$REPO_URL" -b "$REPO_BRANCH" openwrt | |
| sudo mv openwrt /mnt/ && sudo ln -s /mnt/openwrt ./ && sudo chown -R "$USER:$GROUPS" /mnt/openwrt | |
| cd openwrt | |
| sed -i '1i src-git kenzo https://github.com/kenzok8/openwrt-packages' feeds.conf.default | |
| sed -i '2i src-git small https://github.com/kenzok8/small' feeds.conf.default | |
| # ========================== | |
| # 缓存 1:dl 下载缓存 | |
| # ========================== | |
| - name: Cache OpenWrt dl | |
| uses: actions/cache@v4 | |
| with: | |
| path: openwrt/dl | |
| key: ${{ runner.os }}-openwrt-dl-${{ hashFiles(env.CONFIG_FILE) }} | |
| restore-keys: | | |
| ${{ runner.os }}-openwrt-dl- | |
| # ========================== | |
| # 缓存 2:ccache(加速二次编译) | |
| # ========================== | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.ccache | |
| key: ${{ runner.os }}-ccache-${{ hashFiles(env.CONFIG_FILE) }} | |
| restore-keys: | | |
| ${{ runner.os }}-ccache- | |
| - name: Update & Install feeds | |
| working-directory: ./openwrt | |
| run: | | |
| ./scripts/feeds update -a | |
| ./scripts/feeds install -a | |
| - name: Configuration Customization - Build_redmi_ax6000 | |
| run: | | |
| [ -e "$CONFIG_FILE" ] && mv "$CONFIG_FILE" openwrt/.config | |
| chmod +x ./customize.sh && ./customize.sh | |
| cd openwrt && make defconfig | |
| - name: Download package | |
| working-directory: ./openwrt | |
| run: | | |
| make download -j"$(nproc)" | |
| find dl -size -1024c -exec ls -l {} \; | |
| find dl -size -1024c -exec rm -f {} \; | |
| - name: Build firmware | |
| working-directory: ./openwrt | |
| run: | | |
| echo -e "$(nproc) threads for build." | |
| make -j"$(nproc)" V=s | |
| cp .config bin/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@master | |
| with: | |
| name: OpenWrt_bin${{ env.DEV_NAME }}${{ env.FILE_DATE }} | |
| path: openwrt/bin | |
| - name: 删除运行记录 | |
| uses: GitRML/delete-workflow-runs@main | |
| with: | |
| retain_days: 1 | |
| keep_minimum_runs: 3 |