OpenWrt-CI #236
This file contains 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
# | |
# This is free software, lisence use MIT. | |
# | |
# Copyright (C) 2019 P3TERX <https://p3terx.com> | |
# Copyright (C) 2020 KFERMercer <KFER.Mercer@gmail.com> | |
# | |
# <https://github.com/KFERMercer/OpenWrt-CI> | |
# | |
name: OpenWrt-CI | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '.github/workflows/**' | |
schedule: | |
- cron: '30 20 * * 0,3' | |
release: | |
types: [published] | |
branches: | |
- master | |
jobs: | |
build_openwrt: | |
name: Build OpenWrt firmware | |
runs-on: ubuntu-latest | |
# if: github.event.repository.owner.id == github.event.sender.id | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Space cleanup | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
docker rmi `docker images -q` | |
sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android | |
sudo -E apt-mark hold grub-efi-amd64-signed | |
sudo -E apt update | |
sudo -E apt-get -y purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* snapd* || true | |
sudo -E apt-get -y full-upgrade | |
sudo -E apt -y install ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python3 python3-pip libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev | |
sudo -E systemctl daemon-reload | |
sudo -E apt-get -y autoremove --purge | |
sudo -E apt-get clean | |
sudo -E timedatectl set-timezone "Asia/Shanghai" | |
df -h | |
- name: Update feeds | |
run: | | |
echo 'src-git kenzo https://github.com/kenzok8/openwrt-packages' >> ./feeds.conf.default | |
# echo 'src-git openwrt_kiddin9 https://github.com/kiddin9/openwrt-packages' >> ./feeds.conf.default | |
./scripts/feeds update -a | |
./scripts/feeds install -a | |
- name: Generate configuration file | |
run: | | |
rm -f ./.config* | |
touch ./.config | |
# | |
# ========================固件定制部分======================== | |
# | |
# | |
# 如果不对本区块做出任何编辑, 则生成默认配置固件. | |
# | |
# 以下为定制化固件选项和说明: | |
# | |
# | |
# 有些插件/选项是默认开启的, 如果想要关闭, 请参照以下示例进行编写: | |
# | |
# ========================================= | |
# | # 取消编译VMware镜像: | | |
# | cat >> .config <<EOF | | |
# | # CONFIG_VMDK_IMAGES is not set | | |
# | EOF | | |
# ========================================= | |
# | |
# | |
# 以下是一些提前准备好的一些插件选项. | |
# 直接取消注释相应代码块即可应用. 不要取消注释代码块上的汉字说明. | |
# 如果不需要代码块里的某一项配置, 只需要删除相应行. | |
# | |
# 如果需要其他插件, 请按照示例自行添加. | |
# 注意, 只需添加依赖链顶端的包. 如果你需要插件 A, 同时 A 依赖 B, 即只需要添加 A. | |
# | |
# 无论你想要对固件进行怎样的定制, 都需要且只需要修改 EOF 回环内的内容. | |
# | |
# 编译x64固件: | |
cat >> .config <<EOF | |
CONFIG_TARGET_x86=y | |
CONFIG_TARGET_x86_64=y | |
CONFIG_TARGET_x86_64_Generic=y | |
EOF | |
# 固件压缩: | |
cat >> .config <<EOF | |
CONFIG_TARGET_IMAGES_GZIP=y | |
EOF | |
# 编译UEFI固件: | |
cat >> .config <<EOF | |
CONFIG_EFI_IMAGES=y | |
EOF | |
# IPv6支持: | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y | |
CONFIG_PACKAGE_ipv6helper=y | |
EOF | |
# intel无线网卡支持 (Only for intel ac8265 and ax210 wireless card) | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_kmod-iwlwifi=y | |
# CONFIG_PACKAGE_iwlwifi-firmware-iwl7265d=y | |
CONFIG_PACKAGE_iwlwifi-firmware-iwl8265=y | |
CONFIG_PACKAGE_iwlwifi-firmware-ax210=y | |
CONFIG_PACKAGE_wpad-openssl=y | |
CONFIG_PACKAGE_hostapd-utils=y | |
EOF | |
# 多文件系统支持: | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_kmod-fs-nfs=y | |
CONFIG_PACKAGE_kmod-fs-nfs-common=y | |
CONFIG_PACKAGE_kmod-fs-nfs-v3=y | |
CONFIG_PACKAGE_kmod-fs-nfs-v4=y | |
CONFIG_PACKAGE_kmod-fs-ntfs=y | |
CONFIG_PACKAGE_kmod-fs-squashfs=y | |
EOF | |
# USB3.0支持: | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_kmod-usb-ohci=y | |
CONFIG_PACKAGE_kmod-usb-ohci-pci=y | |
CONFIG_PACKAGE_kmod-usb2=y | |
CONFIG_PACKAGE_kmod-usb2-pci=y | |
CONFIG_PACKAGE_kmod-usb3=y | |
EOF | |
# 常用LuCI插件选择: | |
# 相关插件清单可参考 https://www.right.com.cn/forum/thread-344825-1-1.html | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_luci-app-ttyd=y | |
CONFIG_PACKAGE_luci-app-wrtbwmon=y | |
CONFIG_PACKAGE_luci-app-advancedsetting=y | |
CONFIG_PACKAGE_luci-app-arpbind=y | |
CONFIG_PACKAGE_luci-app-autoreboot=y | |
CONFIG_PACKAGE_luci-app-ddns=y | |
CONFIG_PACKAGE_luci-app-filetransfer=y | |
CONFIG_PACKAGE_luci-app-nlbwmon=y | |
CONFIG_PACKAGE_luci-app-smba=y | |
CONFIG_PACKAGE_luci-app-vlmcsd=y | |
CONFIG_PACKAGE_luci-app-zerotier=y | |
CONFIG_PACKAGE_luci-app-openclash=y | |
CONFIG_PACKAGE_luci-app-adguardhome=y | |
# CONFIG_PACKAGE_luci-app-adbyby-plus is not set | |
# CONFIG_PACKAGE_luci-app-ipsec-vpnd is not set | |
# CONFIG_PACKAGE_luci-app-vsftpd is not set | |
# CONFIG_PACKAGE_luci-app-xlnetacc is not set | |
# CONFIG_PACKAGE_luci-app-ssr-plus is not set | |
# CONFIG_PACKAGE_luci-app-unblockmusic is not set | |
CONFIG_PACKAGE_luci-app-serverchan=y | |
CONFIG_PACKAGE_luci-app-ddnsto=y | |
CONFIG_PACKAGE_luci-app-msd_lite=y | |
CONFIG_PACKAGE_luci-app-uugamebooster=y | |
CONFIG_PACKAGE_luci-app-aria2=y | |
CONFIG_PACKAGE_luci-app-store=y | |
CONFIG_PACKAGE_luci-app-argone-config=y | |
EOF | |
# LuCI主题: | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_luci-theme-argon=y | |
CONFIG_PACKAGE_luci-theme-design=y | |
CONFIG_PACKAGE_luci-theme-argone=y | |
EOF | |
# 常用软件包: | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_curl=y | |
CONFIG_PACKAGE_htop=y | |
CONFIG_PACKAGE_nano=y | |
CONFIG_PACKAGE_screen=y | |
CONFIG_PACKAGE_tree=y | |
CONFIG_PACKAGE_vim-fuller=y | |
CONFIG_PACKAGE_wget=y | |
EOF | |
# [Testing feature] Docker and Management UI | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_docker=y | |
CONFIG_PACKAGE_luci-app-dockerman=y | |
EOF | |
# 取消编译VMware镜像以及镜像填充 (不要删除被缩进的注释符号): | |
cat >> .config <<EOF | |
# CONFIG_TARGET_IMAGES_PAD is not set | |
# CONFIG_VMDK_IMAGES is not set | |
EOF | |
# | |
# ========================固件定制部分结束======================== | |
# | |
sed -i 's/^[ \t]*//g' ./.config | |
make defconfig | |
- name: Make download | |
run: | | |
make download -j8 || make download -j1 V=s | |
rm -rf $(find ./dl/ -size -1024c) | |
df -h | |
- name: Compile firmware | |
run: | | |
make -j$(nproc) || make -j1 V=s | |
echo "=======================" | |
echo "Space usage:" | |
echo "=======================" | |
df -h | |
echo "=======================" | |
du -h ./ --max-depth=1 | |
du -h /mnt/openwrt/ --max-depth=1 || true | |
- name: Prepare artifact | |
run: | | |
mkdir -p ./artifact/firmware | |
mkdir -p ./artifact/package | |
mkdir -p ./artifact/buildinfo | |
rm -rf $(find ./bin/targets/ -type d -name "packages") | |
cp -rf $(find ./bin/targets/ -type f) ./artifact/firmware/ | |
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/ | |
cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/ | |
- name: Deliver buildinfo | |
uses: actions/upload-artifact@v4 | |
with: | |
name: OpenWrt_buildinfo | |
path: ./artifact/buildinfo/ | |
- name: Deliver package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: OpenWrt_package | |
path: ./artifact/package/ | |
- name: Deliver firmware | |
uses: actions/upload-artifact@v4 | |
with: | |
name: OpenWrt_firmware_X86-64 | |
path: ./artifact/firmware/ | |
- name: Set Tag Name | |
run: echo "TAG_NAME=$(date +%Y%m%d)" >> $GITHUB_ENV | |
- name: Upload binaries to release | |
if: github.event.repository.owner.id != github.event.sender.id | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
release_name: OpenWRT X86 firmware Release on ${{ env.TAG_NAME }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./artifact/firmware/*.gz | |
# asset_name: OpenWrt_firmware_X86-64 | |
tag: ${{ env.TAG_NAME }} | |
overwrite: true | |
file_glob: true | |
body: "These .gz files were uploaded by Github actions on ${{ env.TAG_NAME }}.\n\n **Plugin list:** AdguardHome; DDNSto; OpenClash; UUGames; Zerotier; app-store; Docker \n\n **Kernel Version:** 6.6.* \n **Testing HW:** HP t430 *with intel wireless card 8265* \n" |