forked from TurBoTse/Padavan-Build
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (88 loc) · 5.25 KB
/
Hanwckf_CI.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
# Build from hanwckf repo
# BY: TurBoTse
name: Build from hanwckf repo
on:
workflow_dispatch:
inputs:
# schedule: # 自动编译
# - cron: 0 19 * * * # 每天国际时间19点,北京时间凌晨3点执行
watch: # 监视操作
types: [started] # 点击 Star 之后
env:
build_dir: /opt/padavan # 源码目录
images_dir: /opt/images # 固件目录
work_dir: /opt/padavan/trunk # 工作目录
config_dir: /opt/padavan/trunk/configs/templates # 设备模板目录
src_git: https://github.com/hanwckf/rt-n56u.git # 源码地址
jobs:
build:
name: build
runs-on: ubuntu-20.04
if: github.event.repository.owner.id == github.event.sender.id # 自己点的 Star
env:
build_variant: ${{ matrix.build_variant }}
targets: ${{ matrix.targets }}
strategy:
matrix:
include:
- build_variant: "mt7620"
targets: "PSG1208 PSG1218 NEWIFI-MINI MI-MINI MI-3 OYE-001 5K-W20"
- build_variant: "mt7621"
targets: "K2P_nano K2P DIR-878 RM2100 CR660x"
- build_variant: "mt7621-usb"
targets: "XY-C1 JCG-836PRO JCG-AC860M JCG-Y2 DIR-882 A3004NS MSG1500 WR1200JS MI-R3G NEWIFI3 B70"
- build_variant: "mt7628"
targets: "HC5861B MI-NANO MZ-R13 MZ-R13P 360P2 HC5761A HC5661A"
steps:
- name: Checkout main # 导入主分支
uses: actions/checkout@v2
- name: Prepare environment # 准备编译环境
run: | # 安装依赖包
sudo apt update
sudo apt install libtool-bin gperf python3-docutils autopoint gettext
sudo timedatectl set-timezone 'Asia/Shanghai' # 设置时区
- name: Clone source code
run: | # 克隆源码
git clone --depth=1 $src_git $build_dir
- name: Run shellcheck
run: |
cd $work_dir
if [ -f ./tools/shellcheck.sh ]; then sh ./tools/shellcheck.sh; fi
- name: Prepare toolchain
run: | # 下载预编译的构建工具链
mkdir -p $images_dir
cd $build_dir/toolchain-mipsel
sh dl_toolchain.sh
- name: Modify custom configs
run: | # 拷贝文件并修改
if [ -d hanwckf/config ]; then cp -f hanwckf/config/* $work_dir; fi
if [ -d hanwckf/modify ]; then cp -rf hanwckf/modify/* $work_dir; fi
if [ -d hanwckf/scripts ]; then cp -f hanwckf/scripts/* $work_dir; fi
cd $config_dir
for m in $targets; do if [ -f $m.config ]; then \
for MOD in UFSD FAT EXFAT EXT2 EXT3 EXT4 XFS FUSE SWAP; do
sed -i "s/CONFIG_FIRMWARE_ENABLE_${MOD}=y/CONFIG_FIRMWARE_ENABLE_${MOD}=n/" $m.config; done; \
for MOD in UVC SERIAL AUDIO LPRD U2EC HDPARM PARTED SMBD FTPD ARIA ARIA_WEB_CONTROL DUMP1090 RTL_SDR HID XFRM QOS IMQ IFB IPSET NFSD NFSC CIFS NTFS_3G TCPDUMP SMBD36 WINS SMBD_SYSLOG RPL2TP EAP_PEAP HTTPS SFTP DROPBEAR DROPBEAR_FAST_CODE OPENSSH OPENVPN SSWAN OPENSSL_EC OPENSSL_EXE XUPNPD MINIDLNA FIREFLY FFMPEG_NEW TRANSMISSION TRANSMISSION_WEB_CONTROL CURL GDUT_DRCOM DOGCOM MINIEAP NJIT_CLIENT NAPT66 SOFTETHERVPN_SERVER SOFTETHERVPN_CLIENT SOFTETHERVPN_CMD VLMCSD TTYD LRZSZ HTOP NANO IPERF3 MTR SOCAT SRELAY MENTOHUST SCUTCLIENT FRPC FRPS TUNSAFE WIREGUARD SHADOWSOCKS XRAY V2RAY TROJAN SSOBFS ADBYBY KOOLPROXY SMARTDNS SMARTDNSBIN ADGUARDHOME CADDY CADDYBIN WYY WYYBIN ZEROTIER ALIDDNS DDNSTO ALDRIVER MENTOHUST SQM DNSFORWARDER CLOUDFLAREDDNS NVPPROXY DDNS_SSL SSSERVER NPC KUMASOCKS IPT2SOCKS MICROSOCKS; do
sed -i "s/CONFIG_FIRMWARE_INCLUDE_${MOD}=y/CONFIG_FIRMWARE_INCLUDE_${MOD}=n/" $m.config; done; \
fi; done
cd $work_dir
for m in $targets; do if [ -f $m.config ]; then echo "拷贝 $m.config"; cp -f ./$m.config $config_dir/$m.config; fi; done; \
for m in $targets; do if [ -f public.sh ]; then echo "执行 public.sh"; sh ./public.sh; fi; if [ -f $m.sh ]; then echo "执行 $m.sh"; sh ./$m.sh; fi; done; \
- name: Start build firmware
run: | # 执行构建固件
cd $work_dir
for m in $targets; do fakeroot ./build_firmware_ci $m; \
if [ $? = 0 ]; then cp -f images/*.trx $images_dir/Hanwckf_${m}_$(date +%Y%m%d).trx; else exit 1; fi; \
./clear_tree_simple >/dev/null 2>&1; done
- name: Upload images to Artifact
if: ${{ success() }}
uses: actions/[email protected]
with:
name: Hanwckf_3.4_${{ env.build_variant }}
path: ${{ env.images_dir }}
- name: Upload images to WeTransfer
if: ${{ github.event.inputs.uploadwet == 'true' && success() }}
run: | # 上传到 WeTransfer
curl -fsSL git.io/file-transfer | sh
./transfer wet -s -p 16 --no-progress ${images_dir} 2>&1 | tee wetransfer.log
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)"