Test luci-app-turboacc #20
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
name: Test luci-app-turboacc | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- luci | |
- package | |
paths: | |
- '!README.md' | |
- '!.github/**' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
max-parallel: 8 | |
matrix: | |
tag_branche: [master-6.1,master-5.15,openwrt-23.05,openwrt-22.03,v23.05.2,v22.03.5] | |
compile: [FLOW_OFFLOAD,SHORTCUT_FE,SHORTCUT_FE_CM,SHORTCUT_FE_DRV] | |
exclude: | |
- tag_branche: master-5.15 | |
compile: SHORTCUT_FE_DRV | |
#master分支没有可用支持SHORTCUT_FE_DRV的5.15内核架构 | |
steps: | |
- name: 将存储库签出到运行器 | |
uses: actions/checkout@v3 | |
with: | |
ref: 'luci' | |
path: luci-app-turboacc | |
- name: 将存储库签出到运行器 | |
uses: actions/checkout@v3 | |
with: | |
ref: 'package' | |
path: turboacc | |
- name: 设置变量 | |
run: | | |
export TURBOACC_PATH="$(pwd)/turboacc" | |
export LUCI_APP_TURBOACC_PATH="$(pwd)/luci-app-turboacc" | |
echo "TURBOACC_PATH=$TURBOACC_PATH" >> $GITHUB_ENV | |
echo "LUCI_APP_TURBOACC_PATH=$LUCI_APP_TURBOACC_PATH" >> $GITHUB_ENV | |
- name: 检测 | |
run: ls -la $(find $GITHUB_WORKSPACE -type d) | |
- name: 安装编译依赖 | |
run: | | |
sudo -E apt update | |
sudo -E apt-mark hold grub-efi-amd64-signed | |
sudo -E apt -y full-upgrade | |
sudo apt install -y build-essential clang flex bison g++ gawk gcc-multilib g++-multilib \ | |
gettext git libncurses-dev libssl-dev python3-distutils rsync unzip zlib1g-dev file wget | |
sudo -E systemctl daemon-reload | |
sudo -E apt -y autoremove --purge | |
sudo -E apt clean | |
sudo timedatectl set-timezone "Asia/Shanghai" | |
- name: 克隆源代码 | |
run: | | |
git clone https://git.openwrt.org/openwrt/openwrt.git | |
cd openwrt | |
export OPENWRT_ROOT_PATH="$(pwd)" | |
echo "OPENWRT_ROOT_PATH=$OPENWRT_ROOT_PATH" >> $GITHUB_ENV | |
- name: 切换标签/分支 | |
run: | | |
if [ "${{ matrix.tag_branche }}" = "master-6.1" ] || [ "${{ matrix.tag_branche }}" = "master-5.15" ]; then | |
tag_branche=master | |
else | |
tag_branche=${{ matrix.tag_branche }} | |
fi | |
echo "$tag_branche" | |
cd $OPENWRT_ROOT_PATH | |
git checkout $tag_branche | |
- name: 修复问题 | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
sed -i 's/^ DEPENDS:= +kmod-crypto-manager +kmod-crypto-pcbc +kmod-crypto-fcrypt$/ DEPENDS:= +kmod-crypto-manager +kmod-crypto-pcbc +kmod-crypto-fcrypt +kmod-udptunnel4 +kmod-udptunnel6/' package/kernel/linux/modules/netsupport.mk #https://github.com/openwrt/openwrt/commit/ecc53240945c95bc77663b79ccae6e2bd046c9c8 | |
sed -i 's/^ dnsmasq \\$/ dnsmasq-full \\/g' ./include/target.mk | |
sed -i 's/^ b43-fwsquash.py "$(CONFIG_B43_FW_SQUASH_PHYTYPES)" "$(CONFIG_B43_FW_SQUASH_COREREVS)"/ $(TOPDIR)\/tools\/b43-tools\/files\/b43-fwsquash.py "$(CONFIG_B43_FW_SQUASH_PHYTYPES)" "$(CONFIG_B43_FW_SQUASH_COREREVS)"/' ./package/kernel/mac80211/broadcom.mk | |
- name: 更新 feeds | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
./scripts/feeds update -a | |
./scripts/feeds install -a | |
- name: 生成配置文件 | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
if [ "${{ matrix.tag_branche }}" = "master-6.1" ]; then | |
echo "CONFIG_TARGET_qualcommax=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_qualcommax_ipq807x=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_qualcommax_ipq807x_DEVICE_redmi_ax6=y" >> $OPENWRT_ROOT_PATH/.config | |
elif [ "${{ matrix.compile }}" = "SHORTCUT_FE_DRV" ]; then | |
echo "CONFIG_TARGET_ipq807x=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_ipq807x_generic=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_ipq807x_generic_DEVICE_redmi_ax6=y" >> $OPENWRT_ROOT_PATH/.config | |
else | |
echo "CONFIG_TARGET_x86=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_x86_64=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_x86_64_DEVICE_generic=y" >> $OPENWRT_ROOT_PATH/.config | |
fi | |
make defconfig | |
- name: 添加turboacc | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
curl -sSL https://raw.githubusercontent.com/chenmozhijin/turboacc/luci/add_turboacc.sh -o add_turboacc.sh && bash add_turboacc.sh | |
kernel_version="$(sed -n '/CONFIG_LINUX_/p' $OPENWRT_ROOT_PATH/.config | sed -e 's/CONFIG_LINUX_//' -e 's/=y//' -e 's/_/./g')" | |
#log | |
echo "libnftnl-file" | |
ls $OPENWRT_ROOT_PATH/package/libs/libnftnl | |
echo "firewall4-file" | |
ls $OPENWRT_ROOT_PATH/package/network/config/firewall4 | |
echo "nftables-file" | |
ls $OPENWRT_ROOT_PATH/package/network/utils/nftables | |
echo "firewall4-patches" | |
ls $OPENWRT_ROOT_PATH/package/network/config/firewall4/patches/ | |
echo "libnftnl-patches" | |
ls $OPENWRT_ROOT_PATH/package/libs/libnftnl/patches/ | |
echo "nftables-patches" | |
ls $OPENWRT_ROOT_PATH/package/network/utils/nftables/patches/ | |
echo "hack-$kernel_version" | |
ls $OPENWRT_ROOT_PATH/target/linux/generic/hack-$kernel_version | |
echo "pending-$kernel_version" | |
ls $OPENWRT_ROOT_PATH/target/linux/generic/pending-$kernel_version | |
- name: 加载配置并生成配置文件 | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
echo "compile = "${{ matrix.compile }} | |
rm -rf .config .config.old tmp | |
ls -la | |
if [ "${{ matrix.tag_branche }}" = "master-6.1" ]; then | |
echo "CONFIG_TARGET_qualcommax=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_qualcommax_ipq807x=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_qualcommax_ipq807x_DEVICE_redmi_ax6=y" >> $OPENWRT_ROOT_PATH/.config | |
elif [ "${{ matrix.compile }}" = "SHORTCUT_FE_DRV" ]; then | |
echo "CONFIG_TARGET_ipq807x=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_ipq807x_generic=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_ipq807x_generic_DEVICE_redmi_ax6=y" >> $OPENWRT_ROOT_PATH/.config | |
else | |
echo "CONFIG_TARGET_x86=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_x86_64=y" >> $OPENWRT_ROOT_PATH/.config | |
echo "CONFIG_TARGET_x86_64_DEVICE_generic=y" >> $OPENWRT_ROOT_PATH/.config | |
fi | |
echo 'CONFIG_PACKAGE_luci-app-turboacc=y' >> .config | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_BBR_CCA=y' >> .config | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_NFT_FULLCONE=y' >> .config | |
if [ "${{ matrix.compile }}" = "FLOW_OFFLOAD" ]; then | |
echo "FLOW_OFFLOAD" | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_OFFLOADING=y' >> .config | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_SHORTCUT_FE=n' >> .config | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_SHORTCUT_FE_CM=n' >> .config | |
elif [ "${{ matrix.compile }}" = "SHORTCUT_FE" ]; then | |
echo "SHORTCUT_FE" | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_OFFLOADING=n' >> .config | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_SHORTCUT_FE=y' >> .config | |
echo 'CONFIG_PACKAGE_kmod-shortcut-fe-cm=n' >> .config | |
elif [ "${{ matrix.compile }}" = "SHORTCUT_FE_CM" ]; then | |
echo "SHORTCUT_FE_CM" | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_OFFLOADING=n' >> .config | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_SHORTCUT_FE_CM=y' >> .config | |
elif [ "${{ matrix.compile }}" = "SHORTCUT_FE_DRV" ]; then | |
echo "SHORTCUT_FE_DRV" | |
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_OFFLOADING=n' >> .config | |
echo "CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_SHORTCUT_FE_DRV=y" >> $OPENWRT_ROOT_PATH/.config | |
else | |
echo "compile = "${{ matrix.compile }} | |
exit 1 | |
fi | |
echo ".config" | |
cat .config | |
make defconfig | |
echo "diffconfig" | |
./scripts/diffconfig.sh | |
- name: 下载 dl 库 | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
make download -j16 | |
find dl -size -1024c -exec ls -l {} \; | |
find dl -size -1024c -exec rm -f {} \; | |
make download -j16 || make download -j1 V=s | |
# - name: 下载工具链库 | |
# run: | | |
# cd $OPENWRT_ROOT_PATH | |
# mkdir -p staging_dir | |
# CONFIG_TARGET_BOARD=$(sed -n 's/CONFIG_TARGET_BOARD="\(.*\)"/\1/p' .config) #x86 | |
# CONFIG_TARGET_SUBTARGET=$(sed -n 's/CONFIG_TARGET_SUBTARGET="\(.*\)"/\1/p' .config) #64 | |
# if [ "${{ matrix.tag_branche }}" = "master" ]; then | |
# RELEASE=snapshots | |
# elif [ "${{ matrix.tag_branche }}" = "openwrt-23.05" ] || [ "${{ matrix.tag_branche }}" = "v23.05.0" ]; then | |
# RELEASE=releases/v23.05.0 | |
# elif [ "${{ matrix.tag_branche }}" = "openwrt-22.03" ] || [ "${{ matrix.tag_branche }}" = "v22.03.5" ]; then | |
# RELEASE=releases/22.03.5 | |
# fi | |
# FILE_NAME=$(curl -s -L --retry 3 --connect-timeout 20 https://downloads.openwrt.org/snapshots/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/ | grep -m 1 -o "openwrt-toolchain-${CONFIG_TARGET_BOARD}-${CONFIG_TARGET_SUBTARGET}_gcc[^\"]*\.Linux-${CONFIG_TARGET_BOARD}_${CONFIG_TARGET_SUBTARGET}\.tar\.xz" | sed 's/^.*<a href="//' | sort -u) | |
# curl -L --retry 3 --connect-timeout 20 https://downloads.openwrt.org/$RELEASE/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/$FILE_NAME -o staging_dir/toolchain.tar.xz | |
# cd staging_dir | |
# tar xf toolchain.tar.xz | |
# cp -r ./openwrt-toolchain-*/toolchain-* . | |
# rm -rf ./openwrt-toolchain-* | |
- name: 构建工具 | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
make tools/install -j $(($(nproc)+1)) || make tools/install -j1 V=s | |
echo "=======================" | |
echo "空间使用情况:" | |
echo "=======================" | |
df --total -Th | |
echo "=======================" | |
- name: 构建工具链 | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
make toolchain/install -j $(($(nproc)+1)) || make toolchain/install -j1 V=s | |
echo "=======================" | |
echo "空间使用情况:" | |
echo "=======================" | |
df --total -Th | |
echo "=======================" | |
- name: 构建内核 | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
make target/compile -j $(($(nproc)+1)) || make target/compile -j$(nproc) V=s || make target/compile -j1 V=s | |
echo "=======================" | |
echo "空间使用情况:" | |
echo "=======================" | |
df --total -Th | |
echo "=======================" | |
- name: 编译并生成安装包 | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
make package/compile -j $(($(nproc)+1)) || make package/compile -j1 V=s | |
make package/install -j $(($(nproc)+1)) || make package/install -j1 V=s | |
echo "=======================" | |
echo "空间使用情况:" | |
echo "=======================" | |
df --total -Th | |
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: 准备 artifact | |
working-directory: ${{ env.OPENWRT_ROOT_PATH }} | |
run: | | |
mkdir -p ./artifact | |
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact | |
cp -rf $(find ./bin/targets/ -type f -name "*.ipk") ./artifact | |
- name: 上传build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-${{ matrix.tag_branche }}-${{ matrix.compile }} | |
path: ${{ env.OPENWRT_ROOT_PATH }}/artifact/** | |
- name: 收集日志 | |
if: success() || failure() | |
run: | | |
mkdir -p logs | |
cd logs | |
export LOG_PATH="$(pwd)" | |
echo "LOG_PATH=$LOG_PATH" >> $GITHUB_ENV | |
cp -r $OPENWRT_ROOT_PATH/logs $LOG_PATH/openwrt-logs || echo "没有openwrt/logs" | |
cp $OPENWRT_ROOT_PATH/.config $LOG_PATH/openwrt.config || echo "没有openwrt/.config" | |
ls -la $(find $OPENWRT_ROOT_PATH/package/ -type d) >> $LOG_PATH/package_files.list | |
ls -la $(find $OPENWRT_ROOT_PATH/linux/generic/ -type d) >> $LOG_PATH/kp_files.list | |
- name: 上传日志 | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs-${{ matrix.tag_branche }}-${{ matrix.compile }} | |
path: "${{ env.LOG_PATH }}" |