-
Notifications
You must be signed in to change notification settings - Fork 6
117 lines (96 loc) · 4 KB
/
Lienol-openwrt-ci-master.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
#=================================================
# https://github.com/miaoxinwei/openwrt_build
# Description: Build OpenWrt using GitHub Actions
# Lisence: AGPL-3.0
# Author: MXW
#=================================================
name: Lienol-master 固件
on:
# watch:
# types: [started]
push:
branches:
- master
paths:
- 'Lienol/master/buildInfo.yml'
# schedule:
# - cron: 0 20 * * *
env:
TZ: Asia/Shanghai
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: 校验本地文件
uses: actions/checkout@main
- name: 安装编译环境
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt-get -qq update
sudo -E apt-get -qq install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3.5 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget curl swig rsync
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
sudo timedatectl set-timezone "$TZ"
FILE_NAME=master-$(cat Lienol/master/buildInfo.yml | grep version | awk '{print $2}')
echo "::set-env name=FIRMWARE::$FILE_NAME"
- name: 克隆代码
env:
REPO_URL: https://github.com/Lienol/openwrt
REPO_BRANCH: master
run: git clone $REPO_URL -b $REPO_BRANCH openwrt
- name: 自定义配置
env:
CUSTOM_SH: 'custom.sh'
run: |
cd openwrt
mv ../Lienol/master/$CUSTOM_SH ./ && chmod 777 $CUSTOM_SH && ./$CUSTOM_SH
- name: 构建程序包
run: |
cd openwrt
echo "src-git diy1 https://github.com/xiaorouji/openwrt-passwall.git;packages" > feeds.conf.default
echo -e "src-git passwall https://github.com/xiaorouji/openwrt-passwall.git;luci" >> feeds.conf.default
echo -e "src-git packages https://github.com/Lienol/openwrt-packages.git;master" >> feeds.conf.default
echo -e "src-git luci https://github.com/Lienol/openwrt-luci.git;master" >> feeds.conf.default
echo -e "src-git-full routing https://git.openwrt.org/feed/routing.git" >> feeds.conf.default
echo -e "src-git-full telephony https://git.openwrt.org/feed/telephony.git" >> feeds.conf.default
echo -e "src-git lienol https://github.com/Lienol/openwrt-package.git;main" >> feeds.conf.default
echo -e "src-git other https://github.com/Lienol/openwrt-package.git;other" >> feeds.conf.default
./scripts/feeds clean
./scripts/feeds update -a
./scripts/feeds install -a
- name: config文件
run: |
cd openwrt
rm -f .config*
cp ../Lienol/master/x86_64.config .config
make defconfig
- name: 下载编译所需源码
run: |
cd openwrt
make download -j8
find dl -size -1024c -exec rm -f {} \;
- name: 多线程编译
run: |
cd openwrt
echo -e "$(nproc) thread build."
make -j$(nproc) V=s
- name: 单线程编译
if: failure()
run: |
cd openwrt
make -j1 V=s
- name: 清理不必要的文件
run: |
cd openwrt
find ./bin/targets/ -type d -name "packages" | xargs rm -rf {}
find ./bin/targets/ -name "*rootfs*img*" | xargs rm -rf {}
find ./bin/targets/ -name "*efi*img*" | xargs rm -rf {}
- name: 上传固件
uses: actions/upload-artifact@v2
with:
name: ${{ env.FIRMWARE }}
path: ./openwrt/bin/targets/