🚀 编译 (Build) #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🚀 编译 (Build) | |
on: | |
workflow_dispatch: | |
inputs: | |
owner: | |
description: 'ImmortalWrt 仓库的拥有者 (Owner of ImmortalWrt repo)' | |
type: string | |
required: true | |
default: 'padavanonly' | |
repo: | |
description: 'ImmortalWrt 仓库的名字 (Name of ImmortalWrt repo)' | |
type: string | |
required: true | |
default: 'immortalwrtARM' | |
branch: | |
description: 'ImmortalWrt 仓库的分支 (Branch of ImmortalWrt repo)' | |
type: string | |
required: true | |
default: 'mt7986' | |
multithreading: | |
description: '开启多线程编译 (Enable multithreading build)' | |
type: boolean | |
default: true | |
ssh: | |
description: '使用 ssh 连接到编译环境 (Connect to the build environment using ssh)' | |
type: boolean | |
default: false | |
jobs: | |
build: | |
if: ${{inputs.ssh == false}} | |
runs-on: ubuntu-latest | |
name: 🚀 编译 (Build) | |
steps: | |
- name: 释放磁盘空间 | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: true | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
- name: 下载编译所需的依赖 (Install the software packages required for compilation) | |
run: | | |
sudo apt update | |
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib 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 lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev | |
- name: 克隆当前仓库 (Clone current repo) | |
uses: actions/checkout@v4 | |
- name: 克隆 ImmortalWrt 仓库 (Clone ImmortalWrt repo) | |
uses: actions/checkout@v4 | |
with: | |
repository: '${{inputs.owner}}/${{inputs.repo}}' | |
ref: ${{inputs.branch}} | |
path: ImmortalWrt | |
- name: 复制当前仓库的配置文件到 ImmortalWrt 仓库 (Copy current repo config to ImmortalWrt repo) | |
run: cp -f .config feeds.conf.default diy.sh ImmortalWrt/ | |
- name: 运行 diy.sh (Run diy.sh) | |
working-directory: ImmortalWrt | |
run: | | |
chmod +x diy.sh | |
./diy.sh | |
- name: 更新并下载 feeds (Update and download feeds) | |
working-directory: ImmortalWrt | |
run: ./scripts/feeds update -a && ./scripts/feeds install -a | |
- name: 再次复制当前仓库的配置文件到 ImmortalWrt 仓库 (Copy current repo config to ImmortalWrt repo again) | |
run: cp -f .config feeds.conf.default diy.sh ImmortalWrt/ | |
- name: 编译前上传配置 (Upload config before build) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: config-before-build | |
path: | | |
ImmortalWrt/feeds.conf.default | |
ImmortalWrt/.config | |
- name: 多线程编译 ImmortalWrt (Build ImmortalWrt multithreading) | |
if: ${{inputs.multithreading == true}} | |
working-directory: ImmortalWrt | |
run: make -j$(nproc) | |
- name: 单线程编译 ImmortalWrt (Build ImmortalWrt single thread) | |
if: ${{inputs.multithreading == false}} | |
working-directory: ImmortalWrt | |
run: make -j1 V=s | |
- name: 上传编译结果到 Artifact (Upload build result to Artifact) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ImmortalWrt-build-result | |
path: ImmortalWrt/bin/targets | |
build-ssh: | |
if: ${{inputs.ssh == true}} | |
name: 🚀 编译 (Build) - SSH | |
runs-on: ubuntu-latest | |
steps: | |
- name: 释放磁盘空间 | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: true | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
- name: 下载编译所需的依赖 (Install the software packages required for compilation) | |
run: | | |
sudo apt update | |
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib 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 lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev | |
- name: 克隆当前仓库 (Clone current repo) | |
uses: actions/checkout@v4 | |
- name: 克隆 ImmortalWrt 仓库 (Clone ImmortalWrt repo) | |
uses: actions/checkout@v4 | |
with: | |
repository: '${{inputs.owner}}/${{inputs.repo}}' | |
ref: ${{inputs.branch}} | |
path: ImmortalWrt | |
- name: 开启 SSH 服务 (Start SSH service) | |
uses: lhotari/action-upterm@v1 | |
with: | |
wait-timeout-minutes: 20 | |
- name: 编译前上传配置 (Upload config before build) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: config-before-build | |
path: | | |
ImmortalWrt/feeds.conf.default | |
ImmortalWrt/.config | |
- name: 多线程编译 ImmortalWrt (Build ImmortalWrt multithreading) | |
if: ${{inputs.multithreading == true}} | |
working-directory: ImmortalWrt | |
run: make -j$(nproc) | |
- name: 单线程编译 ImmortalWrt (Build ImmortalWrt single thread) | |
if: ${{inputs.multithreading == false}} | |
working-directory: ImmortalWrt | |
run: make -j1 V=s | |
- name: 上传编译结果到 Artifact (Upload build result to Artifact) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ImmortalWrt-build-result | |
path: ImmortalWrt/bin/targets |