Skip to content

Commit 159e6d8

Browse files
add clash test
1 parent 7247cbe commit 159e6d8

File tree

3 files changed

+86
-34
lines changed

3 files changed

+86
-34
lines changed

.github/workflows/build_image_all.yml

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ jobs:
4646
- name: Run Make
4747
run: |
4848
chmod +x ${{ github.workspace }}/build_clash.sh
49-
docker run -i --name openwrt-sdk-${{ matrix.arch }}-${{ matrix.version }} --user root -v ${{ github.workspace }}/build_clash.sh:/build_clash.sh openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }} /build_clash.sh
49+
mkdir -p ${{ github.workspace }}/openclash
50+
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
5051
52+
- uses: actions/upload-artifact@v3
53+
with:
54+
name: openclash-${{ matrix.arch }}-${{ matrix.version }}
55+
path: openclash
5156

5257
build_passwall:
5358
strategy:
@@ -204,41 +209,62 @@ jobs:
204209
version: [master, 22.03-SNAPSHOT, 23.05-SNAPSHOT, 22.03.5]
205210
arch: [x86-64, rockchip-armv8]
206211
if: ${{ always() }}
207-
needs: [build_passwall, build_theme_argon, build_luci_app_netdata]
212+
needs: [build_passwall, build_theme_argon, build_luci_app_netdata, build_openclash]
208213
name: Build Image for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
209214
runs-on: ubuntu-latest
210-
container:
211-
image: openwrt/imagebuilder:${{ matrix.arch }}-${{ matrix.version }}
212-
options: --user root
215+
# container:
216+
# image: openwrt/imagebuilder:${{ matrix.arch }}-${{ matrix.version }}
217+
# options: --user root
213218
defaults:
214219
run:
215220
shell: bash
216221
steps:
222+
- name: Maximize build space
223+
uses: easimon/maximize-build-space@v8
224+
with:
225+
root-reserve-mb: 1024
226+
swap-size-mb: 1024
227+
remove-dotnet: 'true'
228+
remove-android: 'true'
229+
remove-haskell: 'true'
230+
remove-codeql: 'true'
231+
remove-docker-images: 'true'
232+
233+
- name: Checkout
234+
uses: actions/checkout@v2
235+
with:
236+
fetch-depth: 0
237+
217238
- uses: actions/download-artifact@v3
218239
with:
219240
name: passwall-${{ matrix.arch }}-${{ matrix.version }}
220241
- uses: actions/download-artifact@v3
221242
with:
222243
name: luci-theme-argon-${{ matrix.arch }}-${{ matrix.version }}
244+
- uses: actions/download-artifact@v3
245+
with:
246+
name: openclash-${{ matrix.arch }}-${{ matrix.version }}
223247
# - uses: actions/download-artifact@v3
224248
# with:
225249
# name: luci-app-netdata
226-
- name: Prepare Packages
250+
251+
- name: modify docker path
227252
run: |
228-
export VOLUME_HOME=$(pwd)
229-
export BUILD_DIR="/builder"
230-
export BUILDER="buildbot"
231-
cd $BUILD_DIR
232-
mkdir -p $BUILD_DIR/packages/mypackages
233-
cp -r $VOLUME_HOME/* packages/mypackages/
234-
- name: Debug Print
253+
sudo systemctl stop docker.socket
254+
sudo systemctl stop docker
255+
sudo mkdir -p ${{ github.workspace }}/docker
256+
sudo mv /var/lib/docker ${{ github.workspace }}/docker
257+
sudo ln -sf ${{ github.workspace }}/docker /var/lib/docker
258+
sudo systemctl start docker
259+
260+
261+
- name: Prepare Packages
235262
run: |
236-
export VOLUME_HOME=$(pwd)
263+
export VOLUME_HOME=${{ github.workspace }}
237264
export BUILD_DIR="/builder"
238265
export BUILDER="buildbot"
239-
apt update
240-
apt install tree sudo -y
241-
tree $BUILD_DIR/packages
266+
mkdir -p $VOLUME_HOME/mypackages
267+
mv $VOLUME_HOME/*.ipk $VOLUME_HOME/mypackages/
242268
243269
- name: Set profile
244270
run: |
@@ -249,24 +275,25 @@ jobs:
249275
fi
250276
- name: Make Image
251277
run: |
252-
export VOLUME_HOME=$(pwd)
278+
export VOLUME_HOME=${{ github.workspace }}
253279
export BUILD_DIR="/builder"
254280
export BUILDER="buildbot"
255-
cd $BUILD_DIR
256-
chown -R $BUILDER:$BUILDER packages
257-
sudo -u $BUILDER sed -i "s/CONFIG_TARGET_ROOTFS_PARTSIZE=[0-9]\+/CONFIG_TARGET_ROOTFS_PARTSIZE=${{ env.rootfs_size }}/g;s/CONFIG_TARGET_KERNEL_PARTSIZE=[0-9]\+/CONFIG_TARGET_KERNEL_PARTSIZE=${{ env.kernel_size }}/g" .config
258-
echo ${{ env.profile }}
259-
sudo -u $BUILDER make image PROFILE=${{ env.profile }} PACKAGES="${{ env.packages }} packages/mypackages/*"
260-
mkdir -p $VOLUME_HOME/openwrt-${{ matrix.arch }}-${{ matrix.version }}
261-
tree bin/targets
262-
if ${{ matrix.arch == 'x86-64' }}; then
263-
cp bin/targets/x86/64/* $VOLUME_HOME/openwrt-${{ matrix.arch }}-${{ matrix.version }}/
264-
elif ${{ matrix.arch == 'rockchip-armv8' }}; then
265-
cp bin/targets/rockchip/armv8/* $VOLUME_HOME/openwrt-${{ matrix.arch }}-${{ matrix.version }}/
266-
fi
267-
281+
chmod +x $VOLUME_HOME/build_image.sh
282+
docker run -i --name openwrt-imagebuilder-${{ matrix.arch }}-${{ matrix.version }} \
283+
--user root \
284+
-v $VOLUME_HOME/mypackages/:$BUILD_DIR/packages/mypackages/ \
285+
-v $VOLUME_HOME/openwrt_output/:/openwrt_output/ \
286+
-v $VOLUME_HOME/build_image.sh:/build_image.sh \
287+
-e PROFILE=${{ env.profile }} \
288+
-e PACKAGES="${{ env.packages }}" \
289+
-e ROOTFS_SIZE=${{ env.rootfs_size }} \
290+
-e KERNEL_SIZE=${{ env.kernel_size }} \
291+
-e ARCH=${{ matrix.arch }} \
292+
-e VERSION=${{ matrix.version }} \
293+
openwrt/imagebuilder:${{ matrix.arch }}-${{ matrix.version }} /build_image.sh
294+
268295
env:
269-
rootfs_size: 2048
296+
rootfs_size: 4096
270297
kernel_size: 256
271298
packages: luci luci-app-qos luci-app-upnp luci-proto-ipv6 kmod-igc kmod-mt7921e
272299
luci-i18n-base-zh-cn netdata luci-app-ttyd ntpclient luci-app-ntpc pciutils
@@ -285,4 +312,4 @@ jobs:
285312
- uses: actions/upload-artifact@v3
286313
with:
287314
name: openwrt-${{ matrix.arch }}-${{ matrix.version }}
288-
path: openwrt-${{ matrix.arch }}-${{ matrix.version }}
315+
path: openwrt_output

build_clash.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ echo "================== DEBUG PRINT BEGIN =================="
2626
cat .config
2727
echo "================== DEBUG PRINT END =================="
2828
sudo -u $BUILDER make package/luci-app-openclash/luci-app-openclash/compile V=99
29-
tree bin/packages
29+
tree bin/packages
30+
31+
cp -r bin/packages/*/base/* /openclash

build_image.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
4+
export VOLUME_HOME=$(pwd)
5+
export BUILD_DIR="/builder"
6+
export BUILDER="buildbot"
7+
8+
cd $BUILD_DIR
9+
apt-get update
10+
apt install sudo tree -y
11+
12+
tree packages/mypackages
13+
14+
chown -R $BUILDER:$BUILDER packages
15+
sudo -u $BUILDER sed -i "s/CONFIG_TARGET_ROOTFS_PARTSIZE=[0-9]\+/CONFIG_TARGET_ROOTFS_PARTSIZE=$ROOTFS_SIZE/g;s/CONFIG_TARGET_KERNEL_PARTSIZE=[0-9]\+/CONFIG_TARGET_KERNEL_PARTSIZE=$KERNEL_SIZE/g" .config
16+
echo $PROFILE
17+
sudo -u $BUILDER make image PROFILE=$PROFILE PACKAGES="$PACKAGES packages/mypackages/*"
18+
tree bin/targets
19+
if [ "$ARCH" == "x86_64" ]; then
20+
cp bin/targets/x86/64/* /openwrt_output/
21+
elif [ "$ARCH" == "rockchip-armv8" ]; then
22+
cp bin/targets/rockchip/armv8/* /openwrt_output/
23+
fi

0 commit comments

Comments
 (0)