forked from coolsnowwolf/lede
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (115 loc) · 4.58 KB
/
openwrt-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
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
#
# <https://github.com/KFERMercer/OpenWrt-CI>
#
# Copyright (C) 2019 P3TERX
#
# Copyright (C) 2020 KFERMercer
#
name: OpenWrt-CI
on:
schedule:
- cron: 0 20 * * * # 每天北京时间凌晨4点运行
workflow_dispatch: # 允许手动触发
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 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 apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool llvm lrzsz 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"
- name: Checkout OpenWrt
uses: actions/checkout@v3
- name: Clone OpenClash
run: |
rm -rf ./package/luci-app-openclash
mkdir -p ./package/luci-app-openclash
git clone --depth 1 https://github.com/vernesong/OpenClash.git ./package/luci-app-openclash
- 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*
touch ./.config
#
# 在 cat >> .config <<EOF 到 EOF 之间粘贴你的编译配置, 需注意缩进关系
# 例如:
cat >> .config <<EOF
CONFIG_TARGET_x86=y
CONFIG_TARGET_x86_64=y
CONFIG_TARGET_x86_64_Generic=y
CONFIG_PACKAGE_miniupnpd=y
CONFIG_PACKAGE_luci-app-openclash=y
CONFIG_PACKAGE_luci-app-samba4=y
CONFIG_PACKAGE_luci-app-diskman=y
CONFIG_PACKAGE_kmod-usb-net-rtl8152=y
CONFIG_PACKAGE_kmod-usb-net-rtl8152-vendor=n
CONFIG_PACKAGE_ksmbd=n
CONFIG_PACKAGE_autosamba=n
CONFIG_PACKAGE_luci-app-ksmbd=n
CONFIG_PACKAGE_luci-app-ddns=n
CONFIG_PACKAGE_luci-app-upnp=n
EOF
#
# ===============================================================
#
sed -i 's/^[ \t]*//g' ./.config
make defconfig
- name: mnt
run: |
sudo mkdir -p -m 777 /mnt/dl
sudo mkdir -p -m 777 /mnt/build_dir
sudo ln -s /mnt/dl ./dl
sudo ln -s /mnt/build_dir ./build_dir
- name: Download packages
run: |
make download -j16
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/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/