feat:check_packages

This commit is contained in:
dichgrem
2025-07-15 18:49:17 +08:00
parent 51f7438562
commit 8598df77a8
5 changed files with 8239 additions and 1 deletions

117
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,117 @@
name: Build ImmortalWrt
on:
workflow_dispatch:
inputs:
version_type:
description: "版本类型"
required: true
default: "stable"
type: choice
options:
- "snapshot"
- "stable"
branch:
description: "snapshot-branch"
required: false
default: "openwrt-24.10"
type: string
tag:
description: "stable-tag"
required: false
default: "v24.10.2"
type: string
config_path:
description: "Config 路径"
required: true
default: "config/myconfig"
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v4
- name: Determine Git ref
id: refinfo
run: |
if [ "${{ inputs.version_type }}" = "snapshot" ]; then
echo "Using branch '${{ inputs.branch }}'"
echo "ref=${{ inputs.branch }}" >> $GITHUB_OUTPUT
else
echo "Using tag '${{ inputs.tag }}'"
echo "ref=${{ inputs.tag }}" >> $GITHUB_OUTPUT
fi
- name: Clone ImmortalWrt source
run: |
echo "📥 克隆 immortalwrt 仓库ref=${{ steps.refinfo.outputs.ref }}"
git clone --branch "${{ steps.refinfo.outputs.ref }}" \
https://github.com/immortalwrt/immortalwrt.git immortalwrt
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential clang flex bison g++ gawk gettext git \
libncurses-dev libssl-dev python3 python3-dev python3-setuptools \
rsync unzip zlib1g-dev file wget curl \
gzip tar zip xz-utils bzip2 zstd \
make cmake autoconf automake libtool patch diffutils \
findutils grep sed help2man texinfo \
libelf-dev libfuse-dev liblzma-dev libxml2-dev libyaml-dev \
uuid-dev device-tree-compiler antlr3 gperf \
time bc jq xxd swig upx-ucl ccache ecj fastjar imagemagick
- name: Update and install feeds
working-directory: immortalwrt
run: |
echo "📦 更新 feeds"
./scripts/feeds update -a
echo "📦 安装 feeds"
./scripts/feeds install -a
- name: Setup configuration
run: |
echo "📋 校验并复制配置:${{ inputs.config_path }} → immortalwrt/.config"
if [ ! -f "${{ inputs.config_path }}" ]; then
echo "❌ 找不到配置文件:${{ inputs.config_path }}"
exit 1
fi
cp "${{ inputs.config_path }}" immortalwrt/.config
cd immortalwrt
echo "🔄 运行 make oldconfig"
make oldconfig
- name: Download source packages
working-directory: immortalwrt
run: |
echo "⬇️ 下载所有源码包"
make download -j8
- name: Build ImmortalWrt
working-directory: immortalwrt
run: |
JOBS=$(nproc)
echo "🚀 开始全量编译(并行 ${JOBS}"
START=$(date "+%Y-%m-%d %H:%M:%S")
echo "⏱️ 编译开始于: ${START}"
if ! time make world -j${JOBS} 2>&1 | tee build.log; then
echo "❌ 编译失败,输出最后 100 行日志:"
tail -n 100 build.log | sed 's/^/ /'
exit 1
fi
END=$(date "+%Y-%m-%d %H:%M:%S")
echo "✅ 编译成功"
echo "⏱️ 开始: ${START}"
echo "⏱️ 结束: ${END}"
- name: Upload firmware artifacts
uses: actions/upload-artifact@v4
with:
name: immortalwrt-output
path: |
immortalwrt/bin/targets/**/*.{img,bin,tar.gz,zip}