Skip to content

Commit 782bfd3

Browse files
authored
Update openwrt-ci.yml
1 parent 9cd6f16 commit 782bfd3

File tree

1 file changed

+47
-22
lines changed

1 file changed

+47
-22
lines changed

.github/workflows/openwrt-ci.yml

+47-22
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
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]>
16
#
27
# <https://github.com/KFERMercer/OpenWrt-CI>
38
#
4-
# Copyright (C) 2019 P3TERX
5-
#
6-
# Copyright (C) 2020 KFERMercer
7-
#
9+
810
name: OpenWrt-CI
911

1012
on:
11-
schedule:
12-
- cron: 0 20 * * *
13+
push:
14+
branches:
15+
- master
16+
# schedule:
17+
# - cron: 0 20 * * *
1318
release:
1419
types: [published]
15-
16-
permissions:
17-
contents: read
1820

1921
jobs:
2022

2123
build_openwrt:
2224

23-
permissions:
24-
contents: write # for release creation
25-
2625
name: Build OpenWrt firmware
2726

2827
runs-on: ubuntu-latest
2928

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
3130

3231
steps:
3332

@@ -44,25 +43,53 @@ jobs:
4443
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android
4544
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
4645
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
4847
sudo -E apt-get -y autoremove --purge
4948
sudo -E apt-get clean
5049
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+
5159
df -h
5260
5361
- name: Update feeds
5462
run: |
55-
sed -i 's/#src-git helloworld/src-git helloworld/g' ./feeds.conf.default
5663
./scripts/feeds update -a
5764
./scripts/feeds install -a
5865
5966
- 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
6187
6288
- name: Make download
6389
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
6693
6794
- name: Compile firmware
6895
run: |
@@ -72,9 +99,8 @@ jobs:
7299
echo "======================="
73100
df -h
74101
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
78104
79105
- name: Prepare artifact
80106
run: |
@@ -103,7 +129,6 @@ jobs:
103129
with:
104130
name: OpenWrt_firmware
105131
path: ./bin/targets/
106-
107132

108133
- name: Upload release asset
109134
if: github.event == 'release'

0 commit comments

Comments
 (0)