-
Notifications
You must be signed in to change notification settings - Fork 56
326 lines (305 loc) · 17.5 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
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.0-rc2,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: |
kernel_version="$(sed -n '/CONFIG_LINUX_/p' $OPENWRT_ROOT_PATH/.config | sed -e 's/CONFIG_LINUX_//' -e 's/=y//' -e 's/_/./g')"
echo "kernel_version=$kernel_version" >> $GITHUB_ENV
echo kernel_version=$kernel_version
if [ "$kernel_version" = "6.1" ] || [ "$kernel_version" = "5.15" ] || [ "$kernel_version" = "5.10" ] ; then
mkdir -p turboacc_tmp ./package/turboacc
cd turboacc_tmp
#git clone https://github.com/chenmozhijin/turboacc -b package
cd ../package/turboacc
cp -RT $TURBOACC_PATH/nft-fullcone ./nft-fullcone
#git clone https://github.com/fullcone-nat-nftables/nft-fullcone
cp -RT $LUCI_APP_TURBOACC_PATH/luci-app-turboacc ./luci-app-turboacc
#git clone https://github.com/chenmozhijin/turboacc
#mv ./turboacc/luci-app-turboacc ./luci-app-turboacc
rm -rf ./turboacc
cd ../..
if [ "$kernel_version" = "6.1" ] || [ "$kernel_version" = "5.15" ]; then
cp -f $TURBOACC_PATH/hack-$kernel_version/952-add-net-conntrack-events-support-multiple-registrant.patch ./target/linux/generic/hack-$kernel_version/952-add-net-conntrack-events-support-multiple-registrant.patch
elif [ "$kernel_version" = "5.10" ]; then
cp -f $TURBOACC_PATH/hack-$kernel_version/952-net-conntrack-events-support-multiple-registrant.patch ./target/linux/generic/hack-$kernel_version/952-net-conntrack-events-support-multiple-registrant.patch
else
echo "不支持的内核版本:$kernel_version"
exit 1
fi
echo "# CONFIG_NF_CONNTRACK_CHAIN_EVENTS is not set" >> target/linux/generic/config-$kernel_version
if [ "${{ matrix.compile }}" = "SHORTCUT_FE" ] || [ "${{ matrix.compile }}" = "SHORTCUT_FE_CM" ] || [ "${{ matrix.compile }}" = "SHORTCUT_FE_DRV" ]; then
cp -f $TURBOACC_PATH/hack-$kernel_version/953-net-patch-linux-kernel-to-support-shortcut-fe.patch ./target/linux/generic/hack-$kernel_version/953-net-patch-linux-kernel-to-support-shortcut-fe.patch
cp -f $TURBOACC_PATH/pending-$kernel_version/613-netfilter_optional_tcp_window_check.patch ./target/linux/generic/pending-$kernel_version/613-netfilter_optional_tcp_window_check.patch
echo "# CONFIG_SHORTCUT_FE is not set" >> target/linux/generic/config-$kernel_version
fi
rm -rf ./package/libs/libnftnl ./package/network/config/firewall4 ./package/network/utils/nftables
mkdir -p ./package/network/config/firewall4 ./package/libs/libnftnl ./package/network/utils/nftables
cp -r $TURBOACC_PATH/shortcut-fe ./package/turboacc
cp -RT $TURBOACC_PATH/firewall4-$(grep -o 'FIREWALL4_VERSION=.*' $TURBOACC_PATH/version | cut -d '=' -f 2)/firewall4 ./package/network/config/firewall4
cp -RT $TURBOACC_PATH/libnftnl-$(grep -o 'LIBNFTNL_VERSION=.*' $TURBOACC_PATH/version | cut -d '=' -f 2)/libnftnl ./package/libs/libnftnl
cp -RT $TURBOACC_PATH/nftables-$(grep -o 'NFTABLES_VERSION=.*' $TURBOACC_PATH/version | cut -d '=' -f 2)/nftables ./package/network/utils/nftables
rm -rf turboacc_tmp
./scripts/feeds update -a
./scripts/feeds install -a
else
echo "不支持的内核版本:$kernel_version"
exit 1
fi
if [ "${{ matrix.compile }}" = "FLOW_OFFLOAD" ]; then
rm -rf ./target/linux/generic/hack-$kernel_version/953-net-patch-linux-kernel-to-support-shortcut-fe.patch
rm -rf ./target/linux/generic/pending-$kernel_version/613-netfilter_optional_tcp_window_check.patch
fi
#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-rc2" ]; then
# RELEASE=releases/23.05.0-rc2
# 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
- 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 }}"