Merge branch 'coolsnowwolf:master' into master #4
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) 2019 KFERMercer <[email protected]> | |
# | |
# <https://github.com/KFERMercer/OpenWrt-CI> | |
# | |
name: OpenWrt-CI | |
on: | |
push: | |
branches: | |
- master | |
# ↑↑↑ 改成你的分支名, 一般是master | |
# schedule: | |
# - cron: 0 20 * * * | |
# release: | |
# types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout OpenWrt | |
uses: actions/checkout@master | |
with: | |
ref: master | |
# ↑↑↑ 改成你的分分支分支支名, 一般是master | |
- name: Initialization environment | |
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 -y purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* snap* | |
sudo -E apt -y full-upgrade | |
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \ | |
bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gettext gcc-multilib g++-multilib \ | |
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev \ | |
libltdl-dev libmpc-dev libmpfr-dev libncurses-dev libncurses-dev libpython3-dev libreadline-dev \ | |
libssl-dev libtool llvm lrzsz genisoimage msmtp ninja-build p7zip p7zip-full patch pkgconf python3 \ | |
python3-pyelftools python3-setuptools 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 -y autoremove --purge | |
sudo -E apt clean | |
sudo -E timedatectl set-timezone "Asia/Shanghai" | |
df -h | |
- name: Update feeds | |
run: | | |
# 避免warning | |
rm -rf ./feeds1 | |
- name: 自定义插件主题 | |
run: | | |
# git clone https://github.com/sirpdboy/netspeedtest.git package/netspeedtest | |
# git clone https://github.com/richaradlee/small-package | |
# git clone https://github.com/jerrykuku/lua-maxminddb.git #git lua-maxminddb 依赖 | |
# git clone https://github.com/jerrykuku/luci-app-vssr.git | |
# git rm -r --cached . | |
# git add . | |
# git commit -m "Clear cache" | |
cd package/lean | |
git clone https://github.com/jerrykuku/luci-theme-argon.git | |
# rm -rf luci-theme-argon | |
# git clone -b 18.06 https://github.com/jerrykuku/luci-theme-argon.git luci-theme-argon | |
- name: Update feeds | |
run: | | |
sed -i 's/#src-git helloworld/src-git helloworld/g' ./feeds.conf.default | |
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 | |
./scripts/feeds update -a && rm -rf feeds/luci/applications/luci-app-mosdns && rm -rf feeds/packages/net/{alist,adguardhome,smartdns} | |
rm -rf feeds/packages/lang/golang | |
git clone https://github.com/kenzok8/golang feeds/packages/lang/golang | |
git clone https://github.com/gdy666/luci-app-lucky.git package/lucky | |
./scripts/feeds update -a | |
./scripts/feeds install -a | |
- name: Costom configure 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 | |
# Image Config | |
CONFIG_TARGET_KERNEL_PARTSIZE=128 | |
CONFIG_TARGET_ROOTFS_PARTSIZE=640 | |
# 固件压缩: | |
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 | |
# 多文件系统支持: | |
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插件选择: | |
cat >> .config <<EOF | |
# CONFIG_PACKAGE_luci-app-adbyby-plus=y | |
# CONFIG_PACKAGE_luci-app-aria2=y | |
# CONFIG_PACKAGE_luci-app-docker=y | |
CONFIG_PACKAGE_luci-app-frpc=y | |
CONFIG_PACKAGE_luci-app-hd-idle=y | |
CONFIG_PACKAGE_luci-app-minidlna=y | |
CONFIG_PACKAGE_luci-app-openvpn=y | |
CONFIG_PACKAGE_luci-app-openvpn-server=y | |
# CONFIG_PACKAGE_luci-app-qbittorrent=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Kcptun=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Server=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Socks=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_V2ray=y | |
CONFIG_PACKAGE_luci-app-ttyd=y | |
# CONFIG_PACKAGE_luci-app-v2ray-server=y | |
CONFIG_PACKAGE_luci-app-verysync=y | |
CONFIG_PACKAGE_luci-app-webadmin=y | |
CONFIG_PACKAGE_luci-app-wireguard=y | |
CONFIG_PACKAGE_luci-app-wrtbwmon=y | |
CONFIG_PACKAGE_luci-app-softethervpn=y | |
CONFIG_PACKAGE_luci-app-passwall=y | |
CONFIG_PACKAGE_luci-app-passwall2=y | |
CONFIG_PACKAGE_luci-app-netdata=y | |
CONFIG_PACKAGE_luci-app-smartdns=y | |
CONFIG_PACKAGE_luci-app-watchcat=y | |
# CONFIG_PACKAGE_luci-app-transmission=y | |
CONFIG_PACKAGE_luci-app-cpufreq=y | |
# CONFIG_PACKAGE_luci-app-baidupcs-web=y | |
# CONFIG_PACKAGE_luci-app-mwan3=y | |
# CONFIG_PACKAGE_luci-app-mwan3helper=y | |
# CONFIG_PACKAGE_luci-app-airplay2=y | |
CONFIG_PACKAGE_luci-app-ssr-plus=y | |
CONFIG_PACKAGE_luci-app-diskman=y | |
CONFIG_PACKAGE_luci-app-frps=y | |
CONFIG_PACKAGE_luci-app-nfs=y | |
# CONFIG_PACKAGE_luci-app-vssr=y | |
CONFIG_PACKAGE_luci-app-openclash=y | |
# CONFIG_PACKAGE_luci-app-uugamebooster=y | |
# CONFIG_PACKAGE_luci-app-adguardhome=y | |
CONFIG_PACKAGE_luci-app-eqos=y | |
CONFIG_PACKAGE_luci-app-pushbot=y | |
# CONFIG_PACKAGE_luci-app-aliyundrive-webdav=y | |
CONFIG_PACKAGE_luci-app-unblockneteasemusic=y | |
# CONFIG_PACKAGE_luci-app-mosdns=y | |
# CONFIG_PACKAGE_luci-app-udpxy=y | |
# CONFIG_PACKAGE_luci-app-store=y | |
CONFIG_PACKAGE_luci-app-advanced=y | |
# CONFIG_PACKAGE_luci-app-netspeedtest=y | |
CONFIG_PACKAGE_luci-app-msd_lite=y | |
CONFIG_PACKAGE_luci-app-lucky=y | |
EOF | |
# LuCI主题: | |
cat >> .config <<EOF | |
CONFIG_PACKAGE_luci-theme-argon=y | |
# CONFIG_PACKAGE_luci-theme-netgear=y | |
# CONFIG_PACKAGE_luci-theme-neobird=y | |
# CONFIG_PACKAGE_luci-theme-tomato=y | |
# CONFIG_PACKAGE_luci-theme-argon_new=y | |
# CONFIG_PACKAGE_luci-theme-edge=y | |
# CONFIG_PACKAGE_luci-theme-ifit=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 | |
CONFIG_PACKAGE_chinadns-gn=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 | |
# find dl -size -1024c -exec rm -f {} \; | |
- 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 ./ --exclude=build_dir --exclude=bin | |
du -h --max-depth=1 ./build_dir | |
du -h --max-depth=1 ./bin | |
- 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@v3 | |
with: | |
name: OpenWrt_firmware_241116 | |
path: ./artifact/buildinfo/ | |
- name: Deliver package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenWrt_package | |
path: ./artifact/package/ | |
- name: Deliver firmware | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenWrt_firmware_241204 | |
path: ./bin/targets/ | |
- name: Upload release asset | |
if: github.event == 'release' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.YOURTOKEN }} | |
file: ./artifact/firmware/* | |
tag: ${{ github.ref }} | |
file_glob: true | |
- name: Upload firmware | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenWrt_firmware | |
path: ./bin/targets/ |