forked from zongheng23333/IPQ
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (100 loc) · 5.34 KB
/
xanmod_main_cloud.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
name: xanmod main cloud kernel deb
on:
workflow_dispatch:
schedule:
- cron: 0 22 * * 2
env:
TZ: Asia/Shanghai
BUILD_TYPE: cloud
jobs:
Build:
runs-on: [self-hosted, Linux]
steps:
- name: Check Xanmod Version
run: |
echo "CPU物理数量: $(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l)"
echo "CPU核心数量: $(nproc)"
echo -e "CPU型号信息:$(cat /proc/cpuinfo | grep -m1 name | awk -F: '{print $2}')\n"
echo "已安装内存详细信息:"
echo -e "$(sudo lshw -short -C memory | grep GiB)\n"
echo "硬盘数量: $(ls /dev/sd* | grep -v [1-9] | wc -l)" && df -hT && date
set -ex
sudo -E rm -f /dev/shm/changelog || true
curl -L "https://xanmod.key2p.com/?version=main" > /dev/shm/changelog
kernel_ver=$(grep "/</a>" /dev/shm/changelog | head -n 1)
[ -z "${kernel_ver}" ] && (cat /dev/shm/changelog; exit 1)
kernel_regex='"([0-9.]+)/"'
[[ $kernel_ver =~ $kernel_regex ]] && export KERNEL_BASE_VER=${BASH_REMATCH[1]}
[ -z "${KERNEL_BASE_VER}" ] && echo "invalid kernel version ${KERNEL_BASE_VER}, exit" && exit 1
curl -L "https://dl.xanmod.org/changelog/${KERNEL_BASE_VER}/?C=M;O=D" > /dev/shm/changelog
xanmod_ver=$(grep ChangeLog /dev/shm/changelog | grep -v "\-rt" | head -n 1)
[ -z "${xanmod_ver}" ] && (cat /dev/shm/changelog; curl -L "https://xanmod.key2p.com/?version=${KERNEL_BASE_VER}" > /dev/shm/changelog) || true
xanmod_ver=$(grep ChangeLog /dev/shm/changelog | grep -v "\-rt" | head -n 1)
[ -z "${xanmod_ver}" ] && (cat /dev/shm/changelog; exit 1)
xanmod_regex='ChangeLog-([0-9.]+-xanmod[0-9]+)'
[[ $xanmod_ver =~ $xanmod_regex ]] && echo "XANMOD_PATCH_VER=${BASH_REMATCH[1]}" >> $GITHUB_ENV
echo "KERNEL_BASE_VER=${KERNEL_BASE_VER}" >> $GITHUB_ENV
echo "KERNEL_BASE_URL=https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${KERNEL_BASE_VER}.tar.xz" >> $GITHUB_ENV
- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
[ -z "${KERNEL_BASE_VER}" ] && echo "invalid kernel version ${KERNEL_BASE_VER}, exit" && exit 1
[ -z "${XANMOD_PATCH_VER}" ] && echo "invalid xanmod version ${XANMOD_PATCH_VER}, exit" && exit 1
echo "XANMOD_PATCH=https://sourceforge.net/projects/xanmod/files/releases/main/${XANMOD_PATCH_VER}/patch-${XANMOD_PATCH_VER}.xz/download" >> $GITHUB_ENV
sudo -E rm -rf /usr/share/dotnet /etc/apt/sources.list.d /usr/local/lib/android $AGENT_TOOLSDIRECTORY || true
sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* powershell openjdk* mongodb* moby* || true
sudo -E /bin/bash -c "systemctl daemon-reload; apt-get -y autoremove --purge; apt-get -y clean" || true
sudo -E timedatectl set-timezone "$TZ" || true
- name: Checkout
uses: actions/checkout@main
- name: Clone Source Code
run: |
df -hT $GITHUB_WORKSPACE
echo "WORK_DIR=/dev/shm/build_linux" >> $GITHUB_ENV
- name: Compile Firmware
env:
DEBIAN_FRONTEND: noninteractive
id: compile
run: |
set -ex
sudo -E rm -rf $WORK_DIR || true
sudo -E bash $GITHUB_WORKSPACE/build_xanmod_docker.sh
export PATH="/opt/llvm19_krl/llvm-19.1.4-x86_64/bin/:$PATH"
bash $GITHUB_WORKSPACE/build_xanmod_kernel.sh
mkdir -p $WORK_DIR/debs || true
mv -f $WORK_DIR/*.deb $WORK_DIR/debs/ || true
echo "DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
echo "FILE_DATE=$(date +"%Y.%m.%d")" >> $GITHUB_ENV
cd $WORK_DIR/debs/
echo "FIRMWARE_PATH=$PWD" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
- name: Check Space Usage
if: (!cancelled())
run: df -hT
- name: Upload Firmware To Release
if: steps.compile.outputs.status == 'success'
uses: ncipollo/release-action@v1
with:
name: R${{ env.DATE }} ${{env.BUILD_TYPE}} kernel for ${{ env.KERNEL_BASE_VER }}
allowUpdates: true
tag: ${{env.BUILD_TYPE}}_${{ env.KERNEL_BASE_VER }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ${{ env.FIRMWARE_PATH }}/*
body: |
**This is XanMod Cloud Kernel for ${{ env.KERNEL_BASE_VER }}**
### 📒 固件信息(x86_64版本)
- ⚽ 固件源码: ${{ env.XANMOD_PATCH }}
- 💝 源码分支: ${{ env.KERNEL_BASE_VER }}
- 🚀 内核版本: ${{ env.XANMOD_PATCH_VER }}
- name: clean
run: |
[ ! -z $WORK_DIR ] && (sudo -E rm -rf $WORK_DIR || true)
- name: report ok
if: ${{ always() && (steps.compile.outputs.status == 'success' && env.FIRMWARE_PATH != '') }}
run: |
cd /dev/shm && curl "https://xanmod.key2p.com/notice?t=编译成功&msg=C_${KERNEL_BASE_VER}" || true
- name: report fail
if: ${{ always() && (steps.compile.outputs.status != 'success' || env.FIRMWARE_PATH == '') }}
run: |
cd /dev/shm && curl "https://xanmod.key2p.com/notice?t=编译失败&msg=C_${KERNEL_BASE_VER}" || true