-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (131 loc) · 4.75 KB
/
x86-OpenWrt.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: OpenWrt for x86
on:
push:
branches:
- master
paths:
- 'CHANGELOG.md'
- '.github/workflows/x86-OpenWrt.yml'
env:
UPLOAD_FIRMWARE: true
TZ: Asia/Shanghai
MYOPENWRTTARGET: x86
jobs:
build:
runs-on: ubuntu-22.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'master'
- name: Show system
run: |
echo -e "Total CPU cores\t: $(nproc)"
grep 'model name' /proc/cpuinfo
free -h
uname -a
[ -f /proc/version ] && cat /proc/version
[ -f /etc/issue.net ] && cat /etc/issue.net
- name: Free disk space
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E swapoff -a
sudo -E rm -f /swapfile
sudo -E docker image prune -a -f
sudo -E snap set system refresh.retain=2
sudo -E apt-get -qq --fix-missing update
sudo -E apt-get -qq -y --fix-missing purge dotnet* google* llvm* mono* mysql* php* zulu*
sudo -E apt-get -qq -y --fix-missing autoremove --purge
sudo -E rm -rf /usr/share/dotnet /usr/local/lib/android /etc/mysql /etc/php
df -h
- name: Init build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E rm -rf /etc/apt/sources.list.d/*
sudo -E apt-get -qq --fix-missing update
sudo -E apt-get -qq --fix-missing install -y antlr3 aria2 asciidoc autoconf automake autopoint bash binutils build-essential bzip2 ccache clang cmake coreutils cpio curl device-tree-compiler diffutils dwarves findutils flex g++ g++-multilib gawk gcc gcc-multilib genisoimage gettext git gnutls-dev gperf grep gzip help2man intltool jq lib32gcc-s1 libc6-dev-i386 libelf-dev libglib2.0-dev libncurses-dev libreadline-dev libssl-dev libthread-queue-any-perl libtool libusb-dev lld llvm lrzsz make msmtp nano p7zip-full patch perl perl-modules python2-dev python3-dev python3-pip python3-ply python3-pyelftools qemu-utils rsync scons subversion swig texinfo time unzip upx-ucl util-linux vim wget xsltproc xxd zlib1g-dev
sudo -E pip3 install pylibfdt
sudo -E apt-get -qq clean
git config --global user.name 'GitHub Actions' && git config --global user.email '[email protected]'
df -h
- name: Prepare OpenWrt
run: |
sudo chown -R runner:docker ./
cp -f ./SCRIPTS/01_get_ready.sh ./01_get_ready.sh
echo "FMDATETIME=$(date '+%Y%m%d-%H%M')" >> $GITHUB_ENV
/bin/bash ./01_get_ready.sh
- name: Prepare Package
run: |
cp -f ./SCRIPTS/*.sh ./openwrt/
cd openwrt
/bin/bash ./02_prepare_package.sh
- name: Remove Upx
run: |
cd openwrt
/bin/bash ./03_remove_upx.sh
- name: Convert Translation
run: |
cd openwrt
/bin/bash ./04_convert_translation.sh
- name: Add ACL
run: |
cd openwrt
/bin/bash ./05_create_acl_for_luci.sh -a
- name: Make Config
run: |
cd openwrt
cp -f ../SEED/x86.config.seed .config
cat ../SEED/more.seed >> .config
make defconfig
- name: Make Download
run: |
df -h
cd openwrt && make download -j$(($(nproc) * 8))
echo $?
- name: Make Toolchain
id: maketoolchain
continue-on-error: true
run: |
df -h
cd openwrt && make toolchain/install -j$(($(nproc) + 1))
echo $?
/bin/ls -AF staging_dir/toolchain-*/bin/
- name: If Toolchain Error
if: steps.maketoolchain.outcome == 'failure'
run: |
cd openwrt && make toolchain/install -j1 V=s
- name: Compile OpenWrt
id: compileopenwrt
continue-on-error: true
run: |
df -h
cd openwrt && make -j$(($(nproc) + 1)) V=w
echo $?
- name: If Compiling Error
if: steps.compileopenwrt.outcome == 'failure'
run: |
cat openwrt/.config
echo '================================================================'
cd openwrt && make -j1 V=s
- name: Cleaning and hashing
run: |
rm -rf ./artifact && mkdir -p ./artifact
cd ./artifact
echo "FIRMWAREDIR=$(pwd)" >> $GITHUB_ENV
cd ../openwrt
cp -f .config ../artifact/kconfig-full
/bin/bash ./scripts/diffconfig.sh > ../artifact/kconfig-lite
cd bin/targets/x86/64
ls -Ahl
/bin/bash ../../../../../SCRIPTS/06_cleaning.sh
mv -f ./* ../../../../../artifact/
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload Firmwares
uses: actions/upload-artifact@v3
if: env.UPLOAD_FIRMWARE == 'true' && ${{ success() }}
with:
name: OpenWrt_x86_${{ env.FMDATETIME }}
path: ${{ env.FIRMWAREDIR }}