-
Notifications
You must be signed in to change notification settings - Fork 7
316 lines (297 loc) · 12 KB
/
build_image_all.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
name: BuildImage-all
on:
workflow_dispatch:
push:
schedule:
- cron: "0 21 * * *"
jobs:
build_openclash:
strategy:
fail-fast: false
matrix:
version: [master, 22.03.6, 23.05.4]
arch: [x86-64, rockchip-armv8]
name: Build OpenClash for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@v8
with:
root-reserve-mb: 1024
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: modify docker path
run: |
sudo systemctl stop docker.socket
sudo systemctl stop docker
sudo mkdir -p ${{ github.workspace }}/docker
sudo mv /var/lib/docker ${{ github.workspace }}/docker
sudo ln -sf ${{ github.workspace }}/docker /var/lib/docker
sudo systemctl start docker
- name: Run Make
run: |
chmod +x ${{ github.workspace }}/build_clash.sh
mkdir -p ${{ github.workspace }}/openclash
docker run -i --name openwrt-sdk-${{ matrix.arch }}-${{ matrix.version }} --user root -v ${{ github.workspace }}/build_clash.sh:/build_clash.sh -v ${{ github.workspace }}/openclash/:/openclash/ openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }} /build_clash.sh
- uses: actions/upload-artifact@v3
with:
name: openclash-${{ matrix.arch }}-${{ matrix.version }}
path: openclash
build_passwall:
strategy:
fail-fast: false
matrix:
version: [master, 22.03.6, 23.05.4]
arch: [x86-64, rockchip-armv8]
name: Build Passwall for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
container:
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }}
options: --user root
defaults:
run:
shell: bash
steps:
- name: Install golang
run: |
# VERSION=`curl -L https://golang.org/VERSION?m=text|awk 'NR==1{print $0}'`
VERSION="go1.20.3"
wget https://go.dev/dl/$VERSION.linux-amd64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf $VERSION.linux-amd64.tar.gz
rm -rf $VERSION.linux-amd64.tar.gz
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
go version
- name: Run Make
run: |
export VOLUME_HOME=$(pwd)
export BUILD_DIR="/builder"
export BUILDER="buildbot"
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
cd $BUILD_DIR
apt-get update
apt install sudo -y
sudo -u $BUILDER echo "src-git passwall https://github.com/xiaorouji/openwrt-passwall.git;main" >> "feeds.conf.default"
sudo -u $BUILDER echo "src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall-packages.git;main" >> "feeds.conf.default"
chown -R $BUILDER:$BUILDER $BUILD_DIR
while ! sudo -u $BUILDER ./scripts/feeds update -a; do echo "Try again"; done
sudo -u $BUILDER ./scripts/feeds install luci-app-passwall
sudo -u $BUILDER make defconfig
### enable all passwall packages
# sudo -u $BUILDER sed -i "s/# \(CONFIG_PACKAGE_luci-app-passwall_.*\) is not set/\1=y/g" .config
### disable singbox
# sudo -u $BUILDER sed -i '/CONFIG_PACKAGE_luci-app-passwall_INCLUDE_SingBox=y/ s/=y/=n/' .config
### disable v2ray-plugin
# sudo -u $BUILDER sed -i '/CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Plugin=y/ s/=y/=n/' .config
### set golang external bootstrap root
# sed -i 's|CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT=""|CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT="/usr/local/go"|' .config
sudo -u $BUILDER make package/luci-app-passwall/compile V=99 -j1 || cat logs/feeds/passwall/luci-app-passwall/dump.txt
mkdir -p $VOLUME_HOME/passwall
cp -r bin/packages/*/passwall/* $VOLUME_HOME/passwall
cp -r bin/packages/*/passwall_packages/* $VOLUME_HOME/passwall
### do not copy all packages, just copy passwall and passwall_packages
# cp -r bin/packages/*/packages/* $VOLUME_HOME/passwall
# cp -r bin/packages $VOLUME_HOME/passwall
- name: Debug Print
run: |
export VOLUME_HOME=$(pwd)
export BUILD_DIR="/builder"
export BUILDER="buildbot"
export PATH=$PATH:/usr/local/go/bin
cd $BUILD_DIR
apt-get update
apt install tree -y
tree bin/packages
- uses: actions/upload-artifact@v3
with:
name: passwall-${{ matrix.arch }}-${{ matrix.version }}
path: passwall
build_theme_argon:
strategy:
fail-fast: false
matrix:
version: [master, 22.03.6, 23.05.4]
arch: [x86-64, rockchip-armv8]
name: Build Argon for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
container:
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }}
options: --user root
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Run Make
run: |
export VOLUME_HOME=$(pwd)
export BUILD_DIR="/builder"
export BUILDER="buildbot"
cd $BUILD_DIR
apt-get update
apt install sudo -y
sudo -u $BUILDER git clone https://github.com/jerrykuku/luci-theme-argon.git package/luci-theme-argon
while ! sudo -u $BUILDER ./scripts/feeds update -a; do echo "Try again"; done
sudo -u $BUILDER make defconfig
sudo -u $BUILDER make package/luci-theme-argon/compile V=s -j1
mkdir -p $VOLUME_HOME/luci-theme-argon
cp bin/packages/*/base/luci-theme-argon*.ipk $VOLUME_HOME/luci-theme-argon/
- uses: actions/upload-artifact@v3
with:
name: luci-theme-argon-${{ matrix.arch }}-${{ matrix.version }}
path: luci-theme-argon
# luci app netdata has some bugs, so just not use it for now!
build_luci_app_netdata:
strategy:
fail-fast: false
matrix:
version: [master, 22.03.6, 23.05.4]
arch: [x86-64, rockchip-armv8]
name: Build Luci App Netdata for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
container:
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }}
options: --user root
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Run Make
run: |
export VOLUME_HOME=$(pwd)
export BUILD_DIR="/builder"
export BUILDER="buildbot"
cd $BUILD_DIR
apt-get update
apt install sudo -y
sudo -u $BUILDER git clone https://github.com/sirpdboy/luci-app-netdata package/luci-app-netdata
while ! sudo -u $BUILDER ./scripts/feeds update -a; do echo "Try again"; done
sudo -u $BUILDER ./scripts/feeds install -a
sudo -u $BUILDER make defconfig
sudo -u $BUILDER make package/luci-app-netdata/compile V=s -j1
mkdir -p $VOLUME_HOME/luci-app-netdata
cp bin/packages/*/base/luci-app-netdata*.ipk $VOLUME_HOME/luci-app-netdata/
- uses: actions/upload-artifact@v3
with:
name: luci-app-netdata-${{ matrix.arch }}-${{ matrix.version }}
path: luci-app-netdata
build_image:
strategy:
fail-fast: false
matrix:
version: [master, 22.03.6, 23.05.4]
arch: [x86-64, rockchip-armv8]
if: ${{ always() }}
needs: [build_passwall, build_theme_argon, build_luci_app_netdata, build_openclash]
name: Build Image for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
# container:
# image: openwrt/imagebuilder:${{ matrix.arch }}-${{ matrix.version }}
# options: --user root
defaults:
run:
shell: bash
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@v8
with:
root-reserve-mb: 1024
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: passwall-${{ matrix.arch }}-${{ matrix.version }}
- uses: actions/download-artifact@v3
with:
name: luci-theme-argon-${{ matrix.arch }}-${{ matrix.version }}
- uses: actions/download-artifact@v3
with:
name: openclash-${{ matrix.arch }}-${{ matrix.version }}
# - uses: actions/download-artifact@v3
# with:
# name: luci-app-netdata
- name: modify docker path
run: |
sudo systemctl stop docker.socket
sudo systemctl stop docker
sudo mkdir -p ${{ github.workspace }}/docker
sudo mv /var/lib/docker ${{ github.workspace }}/docker
sudo ln -sf ${{ github.workspace }}/docker /var/lib/docker
sudo systemctl start docker
- name: Prepare Packages
run: |
export VOLUME_HOME=${{ github.workspace }}
export BUILD_DIR="/builder"
export BUILDER="buildbot"
mkdir -p $VOLUME_HOME/mypackages
mv $VOLUME_HOME/*.ipk $VOLUME_HOME/mypackages/
- name: Set profile
run: |
if ${{ matrix.arch == 'x86-64' }}; then
echo "profile=generic" >> $GITHUB_ENV
elif ${{ matrix.arch == 'rockchip-armv8' }}; then
echo "profile=friendlyarm_nanopi-r2s" >> $GITHUB_ENV
fi
- name: Make Image
run: |
export VOLUME_HOME=${{ github.workspace }}
export BUILD_DIR="/builder"
export BUILDER="buildbot"
chmod +x $VOLUME_HOME/build_image.sh
docker run -i --name openwrt-imagebuilder-${{ matrix.arch }}-${{ matrix.version }} \
--user root \
-v $VOLUME_HOME/mypackages/:$BUILD_DIR/packages/mypackages/ \
-v $VOLUME_HOME/openwrt_output/:/openwrt_output/ \
-v $VOLUME_HOME/build_image.sh:/build_image.sh \
-e PROFILE=${{ env.profile }} \
-e PACKAGES="${{ env.packages }}" \
-e ROOTFS_SIZE=${{ env.rootfs_size }} \
-e KERNEL_SIZE=${{ env.kernel_size }} \
-e ARCH=${{ matrix.arch }} \
-e VERSION=${{ matrix.version }} \
openwrt/imagebuilder:${{ matrix.arch }}-${{ matrix.version }} /build_image.sh
env:
rootfs_size: 4096
kernel_size: 256
packages: luci luci-app-qos luci-app-upnp luci-proto-ipv6 kmod-igc kmod-mt7921e
luci-i18n-base-zh-cn netdata luci-app-ttyd pciutils
coreutils-timeout lm-sensors lm-sensors-detect fdisk shadow-useradd -dnsmasq
vim python3 python3-yaml sudo ipset samba4-server
openvpn-openssl luci-app-openvpn lsof kmod-usb-storage block-mount lsblk luci-app-samba4
tcpdump zstd tmux bash netcat ip6tables-mod-nat iptables-mod-tproxy dnsmasq-full hostapd
wpa-supplicant xl2tpd kmod-loop nfs-kernel-server iptables-mod-socket
iptables-mod-iprange kmod-nft-socket kmod-nft-tproxy kmod-nft-nat
wireguard-tools kmod-wireguard luci-app-wireguard luci-proto-wireguard
# docker dockerd docker-compose tailscale mwan3 luci-app-mwan3
# luci-theme-argon ntpclient luci-app-ntpc
# chinadns-ng dns2socks dns2tcp luci-app-passwall luci-i18n-passwall-zh-cn microsocks
# shadowsocksr-libev-ssr-check shadowsocksr-libev-ssr-local shadowsocksr-libev-ssr-nat
# shadowsocksr-libev-ssr-redir shadowsocksr-libev-ssr-server simple-obfs-server simple-obfs
# tcping trojan-plus v2ray-core v2ray-example v2ray-extra v2ray-plugin
# open-vm-tools
- uses: actions/upload-artifact@v3
with:
name: openwrt-${{ matrix.arch }}-${{ matrix.version }}
path: openwrt_output