1
+ #
2
+ # This is free software, lisence use MIT.
3
+ #
4
+ # Copyright (C) 2019 P3TERX <https://p3terx.com>
5
+ # Copyright (C) 2020 KFERMercer <[email protected] >
1
6
#
2
7
# <https://github.com/KFERMercer/OpenWrt-CI>
3
8
#
4
- # Copyright (C) 2019 P3TERX
5
- #
6
- # Copyright (C) 2020 KFERMercer
7
- #
9
+
8
10
name : OpenWrt-CI
9
11
10
12
on :
11
- schedule :
12
- - cron : 0 20 * * *
13
+ push :
14
+ branches :
15
+ - master
16
+ # schedule:
17
+ # - cron: 0 20 * * *
13
18
release :
14
19
types : [published]
15
-
16
- permissions :
17
- contents : read
18
20
19
21
jobs :
20
22
21
23
build_openwrt :
22
24
23
- permissions :
24
- contents : write # for release creation
25
-
26
25
name : Build OpenWrt firmware
27
26
28
27
runs-on : ubuntu-latest
29
28
30
- if : github.event.repository.owner.id == github.event.sender.id || ! github.event.sender.id
29
+ if : github.event.repository.owner.id == github.event.sender.id
31
30
32
31
steps :
33
32
@@ -44,25 +43,53 @@ jobs:
44
43
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android
45
44
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* adoptopenjdk* mysql* php* mongodb* dotnet* moby* snapd* || true
46
45
sudo -E apt-get update
47
- sudo -E apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler antlr3 gperf swig
46
+ sudo -E apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler antlr3 gperf swig libtinfo5
48
47
sudo -E apt-get -y autoremove --purge
49
48
sudo -E apt-get clean
50
49
50
+ # sudo mkdir -p -m 777 /mnt/openwrt/bin /mnt/openwrt/build_dir/host /mnt/openwrt/build_dir/hostpkg /mnt/openwrt/dl /mnt/openwrt/feeds /mnt/openwrt/staging_dir
51
+ # ln -s /mnt/openwrt/bin ./bin
52
+ # mkdir -p ./build_dir
53
+ # ln -s -f /mnt/openwrt/build_dir/host ./build_dir/host
54
+ # ln -s -f /mnt/openwrt/build_dir/hostpkg ./build_dir/hostpkg
55
+ # ln -s /mnt/openwrt/dl ./dl
56
+ # ln -s /mnt/openwrt/feeds ./feeds
57
+ # ln -s /mnt/openwrt/staging_dir ./staging_dir
58
+
51
59
df -h
52
60
53
61
- name : Update feeds
54
62
run : |
55
- sed -i 's/#src-git helloworld/src-git helloworld/g' ./feeds.conf.default
56
63
./scripts/feeds update -a
57
64
./scripts/feeds install -a
58
65
59
66
- name : Generate configuration file
60
- run : make defconfig
67
+ run : |
68
+ rm -f ./.config*
69
+ touch ./.config
70
+
71
+ #
72
+ # 在 cat >> .config <<EOF 到 EOF 之间粘贴你的编译配置, 需注意缩进关系
73
+ # 例如:
74
+
75
+ cat >> .config <<EOF
76
+ CONFIG_TARGET_IMAGES_GZIP=y
77
+ CONFIG_KERNEL_BUILD_USER="OpenWrt-CI"
78
+ CONFIG_KERNEL_BUILD_DOMAIN="Azure"
79
+ EOF
80
+
81
+ #
82
+ # ===============================================================
83
+ #
84
+
85
+ sed -i 's/^[ \t]*//g' ./.config
86
+ make defconfig
61
87
62
88
- name : Make download
63
89
run : |
64
- make download -j8
65
- find dl -size -1024c -exec rm -f {} \;
90
+ make download -j8 || make download -j1 V=s
91
+ rm -rf $(find ./dl/ -size -1024c)
92
+ df -h
66
93
67
94
- name : Compile firmware
68
95
run : |
72
99
echo "======================="
73
100
df -h
74
101
echo "======================="
75
- du -h --max-depth=1 ./ --exclude=build_dir --exclude=bin
76
- du -h --max-depth=1 ./build_dir
77
- du -h --max-depth=1 ./bin
102
+ du -h ./ --max-depth=1
103
+ du -h /mnt/openwrt/ --max-depth=1 || true
78
104
79
105
- name : Prepare artifact
80
106
run : |
@@ -103,7 +129,6 @@ jobs:
103
129
with :
104
130
name : OpenWrt_firmware
105
131
path : ./bin/targets/
106
-
107
132
108
133
- name : Upload release asset
109
134
if : github.event == 'release'
0 commit comments