Skip to content

PVE-Kernel-CI-Try

PVE-Kernel-CI-Try #61

# This is free software, lisence use MIT.
# Copyright (C) https://github.com/yfdoor
name: PVE-Kernel-CI-Try
# 触发条件
on:
# push:
# branches:
# - master
# schedule:
# - cron: 0 0 * * 3
# release:
# types: [published]
watch:
types: [started]
# 环境变量
env:
REPO_BRANCH: master
UPLOAD_BIN: true
UPLOAD_BRANCH: true
jobs:
build:
runs-on: ubuntu-20.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
# 项目初始
- name: Code Checkout
uses: actions/checkout@main
# 其他分支
- name: Branch Checkout
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
# 环境初始
- name: Initialization
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /swapfile /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo chmod a+w /etc/apt/sources.list
sudo wget -qO - http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg | sudo apt-key add -
sudo -E echo "deb http://download.proxmox.com/debian/pve buster pve-no-subscription" >>/etc/apt/sources.list
sudo wget -qO - http://download.proxmox.com/debian/proxmox-release-bullseye.gpg | sudo apt-key add -
sudo -E echo "deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription" >>/etc/apt/sources.list
# sudo wget -qO - http://ftp.debian.org/debian/dists/bullseye-backports/Release.gpg | sudo apt-key add -
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
sudo -E echo "deb http://deb.debian.org/debian buster-backports main" >>/etc/apt/sources.list
sudo -E apt-get update
sudo -E apt-get upgrade -y
sudo -E apt-get install git nano screen patch fakeroot build-essential devscripts libncurses5 libncurses5-dev libssl-dev bc flex bison libelf-dev libaudit-dev libgtk2.0-dev libperl-dev asciidoc xmlto gnupg gnupg2 rsync lintian debhelper libdw-dev libnuma-dev libslang2-dev sphinx-common asciidoc-base automake cpio dh-python file gcc kmod libiberty-dev libtool perl-modules python2-minimal sed tar zlib1g-dev liblz4-tool idn
sudo -E apt-get install perlapi libpve-rs-perl libproxmox-rs-perl libpve-common-perl dwarves zstd
sudo -E apt-get install -t buster-backports dwarves
sudo -E apt-get autoremove --purge
sudo -E apt-get clean
echo "========================================"
echo "[Space Usage]:"
echo "========================================"
df -hT
echo "========================================"
echo "[File List]:"
echo "========================================"
echo "Current Path:" $PWD
ls -l -A
echo "========================================"
# 下载源码
- name: Clone Code
run: |
git clone git://git.proxmox.com/git/pve-kernel.git -b $REPO_BRANCH pve-kernel
# 修改文件
- name: Modify Code
run: |
cd pve-kernel
sed -i "s/106 @@/105 @@/g" patches/kernel/0003-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch
sed -i "/pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS))/d" patches/kernel/0003-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch
sed -i "s/(dev) ||/(dev))/g" patches/kernel/0003-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch
# 修正 BTF
- name: Fix DEBUG_INFO_BTF
run: |
cd pve-kernel
sed -i 's/${LINUX_TOOLS_DBG_DEB}//' Makefile
# 清理
- name: Freeing up disk space
run: |
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
# sudo apt-get remove -y '^ghc-8.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
rm -rf /usr/share/dotnet/
echo "========================================"
echo "[Space Usage]:"
echo "========================================"
df -hT
echo "========================================"
echo "[File List]:"
echo "========================================"
echo "Current Path:" $PWD
ls -l -A
echo "========================================"
# 开始编译
- name: Compile File
id: compile
run: |
cd pve-kernel
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
echo "========================================"
echo "[Space Usage]:"
echo "========================================"
df -hT
echo "========================================"
echo "[File List]:"
echo "========================================"
echo "Current Path:" $PWD
ls -l -A
echo "========================================"
echo "::set-output name=status::success"
# 检查版本
- name: Get Version
id: getversion
run: |
cd pve-kernel
echo "::set-output name=version::$(ls abi-prev* | sed 's/abi-prev/pve-kernel/g' | sed 's/-pve//g')"
echo ${{ steps.getversion.outputs.version }}
# 准备文件
- name: Organize File
if: steps.compile.outputs.status == 'success'
run: |
mkdir -p PVE
mv -f pve-kernel/*.deb PVE/
mv -f pve-kernel/*.ddeb PVE/
ls ./PVE/pve-kernel*-pve*.deb | xargs -d _ | awk '{print $2}'| xargs echo>tmp.txt
export FNAME="$(cat tmp.txt)"
echo $FNAME
echo "========================================"
echo "[File List]:"
echo "========================================"
echo "Current Path:" $PWD
ls -l -A PVE/
echo "========================================"
# cd $FNAME
# zip -r PVE_Kernel_yfdoor_$FNAME.zip *
# 上传文件
- name: Upload File
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN == 'true'
with:
name: ${{ format('{0}-YFDOOR', steps.getversion.outputs.version)}}
path: PVE
# 更新分支
- name: Upload Branch
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BRANCH == 'true'
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
run: |
git checkout Kernel-Package
sudo rm -rf pve-kernel tmp.txt ${{ steps.getversion.outputs.version }}
sudo mv -f PVE ${{ steps.getversion.outputs.version }}
echo "========================================"
echo "[File List]:"
echo "========================================"
echo "Current Path:" $PWD
ls -l -A
echo "========================================"
git init
git config user.name "yfdoor"
git config user.email "yfdoor@github.com"
git add .
git commit -m "Update PVE-Kernel Package"
git push --force --quiet https://$GITHUB_TOKEN@github.com/yfdoor/PVE-Kernel.git HEAD:Kernel-Package