Skip to content

Commit 18ceeb2

Browse files
authored
Create openwrt-ci2.yml
1 parent cec0c03 commit 18ceeb2

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

.github/workflows/openwrt-ci2.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#
2+
# <https://github.com/KFERMercer/OpenWrt-CI>
3+
#
4+
# Copyright (C) 2019 P3TERX
5+
#
6+
# Copyright (C) 2020 KFERMercer
7+
#
8+
name: OpenWrt-CI
9+
10+
on:
11+
push:
12+
branches: [ master ]
13+
pull_request:
14+
branches: [ master ]
15+
workflow_dispatch: # 同时支持自动+手动触发
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
22+
build_openwrt:
23+
24+
name: Build OpenWrt Firmware
25+
26+
runs-on: ubuntu-22.04
27+
28+
steps:
29+
- name: Space cleanup and Initialization environment
30+
env:
31+
DEBIAN_FRONTEND: noninteractive
32+
run: |
33+
docker rmi `docker images -q`
34+
sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android
35+
sudo -E apt-mark hold grub-efi-amd64-signed
36+
sudo -E apt update
37+
sudo -E apt -y purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* snap*
38+
sudo -E apt -y full-upgrade
39+
sudo -E apt -y install ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool llvm lrzsz msmtp ninja-build p7zip p7zip-full patch pkgconf python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
40+
sudo -E systemctl daemon-reload
41+
sudo -E apt -y autoremove --purge
42+
sudo -E apt clean
43+
sudo -E timedatectl set-timezone "Asia/Shanghai"
44+
45+
- name: Checkout OpenWrt
46+
uses: actions/checkout@v4
47+
48+
- name: Update feeds
49+
run: |
50+
sed -i 's/#src-git helloworld/src-git helloworld/g' ./feeds.conf.default
51+
./scripts/feeds update -a
52+
./scripts/feeds install -a
53+
54+
- name: Generate configuration file
55+
run: make defconfig
56+
57+
- name: Download packages
58+
run: make download -j16
59+
60+
- name: Compile firmware
61+
run: |
62+
make -j$(nproc) || make -j1 V=s
63+
echo "======================="
64+
echo "Space usage:"
65+
echo "======================="
66+
df -h
67+
echo "======================="
68+
du -h --max-depth=1 ./ --exclude=build_dir --exclude=bin
69+
du -h --max-depth=1 ./build_dir
70+
du -h --max-depth=1 ./bin
71+
72+
- name: Prepare artifact
73+
run: |
74+
mkdir -p ./artifact/package
75+
mkdir -p ./artifact/buildinfo
76+
rm -rf $(find ./bin/targets/ -type d -name "packages")
77+
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/
78+
cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
79+
80+
- name: Upload buildinfo
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: OpenWrt_buildinfo
84+
path: ./artifact/buildinfo/
85+
86+
- name: Upload package
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: OpenWrt_package
90+
path: ./artifact/package/
91+
92+
- name: Upload firmware
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: OpenWrt_firmware
96+
path: ./bin/targets/

0 commit comments

Comments
 (0)