OpenWrt-CI #957
Workflow file for this run
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
# | |
# <https://github.com/KFERMercer/OpenWrt-CI> | |
# | |
# Copyright (C) 2019 P3TERX | |
# | |
# Copyright (C) 2020 KFERMercer | |
# | |
name: OpenWrt-CI | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 20 * * * | |
permissions: | |
contents: read | |
jobs: | |
build_openwrt: | |
name: Build OpenWrt Firmware | |
runs-on: ubuntu-latest | |
steps: | |
- name: Space cleanup and Initialization environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
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* llvm* firefox google* dotnet* powershell* mysql* php* dotnet* snap* | |
sudo -E apt -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 libssl-dev libtool nano p7zip p7zip-full patch pkgconf python3 python3-pip libpython3-dev rsync squashfs-tools swig texinfo upx-ucl unzip vim wget xxd zlib1g-dev | |
sudo -E apt -y install clang | |
sudo -E systemctl daemon-reload | |
sudo -E apt -y autoremove --purge | |
sudo -E apt clean | |
sudo -E timedatectl set-timezone "Asia/Shanghai" | |
- name: Checkout OpenWrt | |
uses: actions/checkout@v3 | |
- name: Prepare OpenClash | |
run: | | |
# 编译 po2lmo (如果有po2lmo可跳过) | |
pushd package/luci-app-openclash/tools/po2lmo | |
make && sudo make install | |
popd | |
- name: Update feeds | |
run: | | |
sed -i 's/#src-git helloworld/src-git helloworld/g' ./feeds.conf.default | |
./scripts/feeds update -a | |
./scripts/feeds install -a | |
- name: Generate configuration file | |
run: | | |
rm -f ./.config* | |
# 使用自定义配置 | |
mv ./custom.config .config | |
sed -i 's/^[ \t]*//g' ./.config | |
make defconfig | |
# 默认网络配置 | |
sed -i "2i # network config" ./package/lean/default-settings/files/zzz-default-settings | |
# 默认 LAN 配置 | |
sed -i "3i uci set network.lan.ipaddr='192.168.2.1'" ./package/lean/default-settings/files/zzz-default-settings | |
sed -i "4i uci set network.lan.proto='static'" ./package/lean/default-settings/files/zzz-default-settings | |
sed -i "5i uci set network.lan.type='bridge'" ./package/lean/default-settings/files/zzz-default-settings # 接口类型:桥接 | |
sed -i "6i uci set network.lan.ifname='eth2 eth3'" ./package/lean/default-settings/files/zzz-default-settings # 网络端口:多拨所以两个 wan 口, lan 从第三个口开始 | |
sed -i "7i uci set network.lan.netmask='255.255.255.0'" ./package/lean/default-settings/files/zzz-default-settings | |
sed -i "8i uci set network.lan.ip6assign='64'" ./package/lean/default-settings/files/zzz-default-settings # IPv6 分配长度 | |
# 默认 WAN 配置 | |
sed -i "9i uci set network.wan.proto='pppoe'" ./package/lean/default-settings/files/zzz-default-settings | |
sed -i "10i uci set network.wan.ifname='eth0'" ./package/lean/default-settings/files/zzz-default-settings | |
sed -i "11i uci set network.wan.ipv6='auto'" ./package/lean/default-settings/files/zzz-default-settings | |
sed -i "12i uci set network.wan.keepalive='0'" ./package/lean/default-settings/files/zzz-default-settings | |
sed -i "13i uci commit network\n" ./package/lean/default-settings/files/zzz-default-settings | |
- name: Download packages | |
run: make download -j16 | |
- 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/package | |
mkdir -p ./artifact/buildinfo | |
rm -rf $(find ./bin/targets/ -type d -name "packages") | |
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: Upload buildinfo | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenWrt_buildinfo | |
path: ./artifact/buildinfo/ | |
- name: Upload package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenWrt_package | |
path: ./artifact/package/ | |
- name: Upload firmware | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenWrt_firmware | |
path: ./bin/targets/ |