Skip to content

Build OpenWRT-LEAN for X86-MINI #1

Build OpenWRT-LEAN for X86-MINI

Build OpenWRT-LEAN for X86-MINI #1

name: Build OpenWRT-LEAN for X86-MINI
on:
workflow_dispatch:
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
CONFIG_FILE: x86/.config-mini
DIY_SH: x86/diy.sh
FILES: x86/files
TZ: Asia/Shanghai
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Check machine configuration
run: |
echo "警告⚠"
echo "分配的服务器性能有限,若选择的插件过多,务必注意CPU性能!"
echo "云编译建议取消勾选Node.js及其相关插件!"
echo "已知CPU型号(降序):7763,8370C,8272CL,8171M,E5系列"
echo "--------------------------CPU信息--------------------------"
echo "CPU物理数量:$(cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l)"
echo -e "CPU核心及版本信息:$(cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c) \n"
echo "--------------------------内存信息--------------------------"
echo "已安装内存详细信息:"
sudo lshw -short -C memory | grep GiB
echo -e "\n"
echo "--------------------------硬盘信息--------------------------"
echo -e "硬盘数量:$(ls /dev/sd* | grep -v [1-9] | wc -l) \n"
echo "硬盘详情:"
df -Th
- name: Before freeing up disk space
run: |
echo "Before freeing up disk space"
echo "=============================================================================="
df -hT
echo "=============================================================================="
- name: "Optimize Disk Space"
uses: "hugoalh/[email protected]"
with:
operate_sudo: "True"
general_include: ".+"
general_exclude: |-
^GCC$
^G\+\+$
Clang
LLVM
docker_include: ".+"
docker_prune: "True"
docker_clean: "True"
apt_prune: "True"
apt_clean: "True"
homebrew_prune: "True"
homebrew_clean: "True"
npm_prune: "True"
npm_clean: "True"
os_swap: "True"
- name: Freeing up disk space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 10240
swap-size-mb: 1
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Free up disk space complete
run: |
echo "Free up disk space complete"
echo "=============================================================================="
df -hT
echo "=============================================================================="
- name: Checkout
uses: actions/checkout@main
- name: Initialize environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt update
sudo -E apt -y install $(curl -fsSL https://is.gd/depends_ubuntu_2204)
sudo -E apt -y autoremove --purge
sudo -E apt -y install libfuse-dev
sudo -E apt -y install rename
sudo -E apt -y install time
sudo -E apt -y install gn
sudo -E systemctl daemon-reload
sudo -E apt clean
sudo timedatectl set-timezone "$TZ"
sudo chown $USER:$GROUPS $GITHUB_WORKSPACE
- name: Clone source code
working-directory: ./
run: |
git clone $REPO_URL -b $REPO_BRANCH openwrt
cd openwrt
sed -i 's|https://github.com/coolsnowwolf/luci.git;openwrt-23.05|https://github.com/coolsnowwolf/luci|g' feeds.conf.default
- name: cache wrt build
uses: stupidloud/cachewrtbuild@main
with:
ccache: 'true'
mixkey: x86-${{ env.REPO_BRANCH }}
prefix: ${{ github.workspace }}/openwrt
- name: Update & Install feeds
working-directory: ./openwrt
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: Load custom config
run: |
[ -e $FILES ] && mv $FILES openwrt/files
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
chmod +x $DIY_SH
cd openwrt
$GITHUB_WORKSPACE/$DIY_SH
# - name: SSH connect to Actions
# uses: P3TERX/ssh2actions@main
# if: (github.event.inputs.ssh == 'true') || contains(github.event.action, 'ssh')
- name: Download package
working-directory: ./openwrt
run: |
make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Compile the firmware
run: |
chmod -R 755 openwrt
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
echo "compile_status=success" >> $GITHUB_ENV
- name : Upload packages
uses: actions/upload-artifact@master
if: always()
with:
name: OpenWrt-x86_mini
path: openwrt/bin/targets/