Building kernel #71
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: Building kernel | |
on: # [push] | |
# release: | |
# types: [published] | |
# push: | |
# branches: | |
# - master | |
# paths: | |
# - '.config' | |
# schedule: | |
# - cron: 0 8 * * 5 | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
COMPILER: | |
description: 'compilers used' | |
required: true | |
default: 'Neutron-Clang' | |
KREPO: | |
description: 'kernel repo' | |
required: true | |
default: 'TelegramAt25/android_kernel_xiaomi_selene' | |
KBRANCH: | |
description: 'kernel branch' | |
required: true | |
default: 'niigo' | |
NOTES: | |
description: 'notes to print out' | |
required: false | |
default: '' | |
SUFFIX: | |
description: 'suffix to aplly to teh zip filename' | |
required: false | |
default: '-legacy' | |
KSU: | |
description: 'if dont want ksu then leave blank' | |
required: false | |
default: '' | |
DOTCONFIG: | |
description: 'if you dont need .config uploaded then leaev blank' | |
required: false | |
default: '' | |
env: | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
CHAT_ID: ${{ secrets.CHAT_ID }} | |
REPO: ${{ github.event.inputs.KREPO }} | |
RUN_NUM: ${{ github.run_number }}_${{ github.run_attempt }} | |
KERNEL_BRANCH: ${{ github.event.inputs.KBRANCH }} | |
NOTE: ${{ github.event.inputs.NOTES }} | |
COMPILERS: ${{ github.event.inputs.COMPILER }} | |
PATCH_KSU: ${{ github.event.inputs.KSU }} | |
SUFFIX: ${{ github.event.inputs.SUFFIX }} | |
DOTCONFIG: ${{ github.event.inputs.DOTCONFIG }} | |
TZ: Asia/Ho_Chi_Minh | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: fedora:rawhide | |
steps: | |
- name: checkout | |
uses: actions/checkout@master | |
- name: start of workflow | |
run: | | |
bash tg_utils.sh msg "gh $RUN_NUM: workflow started" | |
echo WORKFLOW_START=$(date +"%s") >> $GITHUB_ENV | |
- name: init build env | |
run: | | |
dnf group install development-tools -y | |
dnf install llvm lld bc bison ca-certificates curl flex glibc-devel.i686 glibc-devel binutils-devel openssl python3 python2 zstd clang gcc-arm-linux-gnu dtc libxml2 libarchive openssl-devel tomsfastmath-devel wget xz -y | |
ln -sf "/usr/bin/python3" /usr/bin/python | |
- name: show host info | |
run: | | |
bash tg_utils.sh msg "gh $RUN_NUM: build env initialized%nlgh $RUN_NUM: host: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'=' -f2)%nlgh $RUN_NUM: free disk space: $(df --sync -BM --output=avail / | grep -v Avail)" | |
- name: print notes if exists | |
run: | | |
if [[ ! -z $NOTE ]]; then | |
bash tg_utils.sh msg "gh $RUN_NUM: $NOTE" | |
fi | |
- name: clone kernel source | |
run: | | |
bash tg_utils.sh msg "gh $RUN_NUM: cloning kernel source%nlgh $RUN_NUM: repo: $REPO%nlgh $RUN_NUM: branch: $KERNEL_BRANCH" | |
git clone --depth=1 --single-branch https://github.com/$REPO -b $KERNEL_BRANCH kernel | |
- name: print kernel info | |
run: | | |
cd kernel | |
source ../env | |
bash ../tg_utils.sh msg "gh $RUN_NUM: kernel name: ${kernel_name}%nlgh $RUN_NUM: kernel ver: ${kernel_ver}%nlgh $RUN_NUM: kernel head commit: ${kernel_head}%nlgh $RUN_NUM: defconfig: ${defconfig}" | |
- name: run compilation scripts | |
run: | | |
cd kernel | |
case $PATCH_KSU in | |
"both" ) | |
bash ../tg_utils.sh msg "gh $RUN_NUM: running compilation script(s): $COMPILERS" | |
bash ../build.sh "$COMPILERS" | |
bash ../tg_utils.sh msg "gh $RUN_NUM: KernelSU patching enabled, patching" | |
bash ../ksu/patch.sh | |
bash ../tg_utils.sh msg "gh $RUN_NUM: running compilation script(s): $COMPILERS" | |
bash ../build.sh "$COMPILERS" | |
;; | |
"" ) | |
bash ../tg_utils.sh msg "gh $RUN_NUM: running compilation script(s): $COMPILERS" | |
bash ../build.sh "$COMPILERS" | |
;; | |
* ) | |
bash ../tg_utils.sh msg "gh $RUN_NUM: KernelSU patching enabled, patching" | |
bash ../ksu/patch.sh | |
bash ../tg_utils.sh msg "gh $RUN_NUM: running compilation script(s): $COMPILERS" | |
bash ../build.sh "$COMPILERS" | |
;; | |
esac | |
- name: upload | |
run: | | |
cd kernel | |
for file in *.zip ; do | |
bash ../tg_utils.sh up "${file}" "$(cat "${file}.info")" | |
done | |
for file in *.log ; do | |
if [[ -e "${file}.info" ]]; then | |
bash ../tg_utils.sh up "${file}" "$(cat "${file}.info")" | |
fi | |
done | |
if [[ ! -z $DOTCONFIG ]]; then | |
bash ../tg_utils.sh up "out/.config" "a" | |
fi | |
- name: if it fails | |
if: ${{ failure() }} | |
run: | | |
WORKFLOW_END=$(date +"%s") | |
WDIFF=$((WORKFLOW_END - WORKFLOW_START)) | |
bash tg_utils.sh msg "gh $RUN_NUM: workflow failed in $((WDIFF / 60))m, $((WDIFF % 60))s" | |
- name: end of workflow | |
run: | | |
WORKFLOW_END=$(date +"%s") | |
WDIFF=$((WORKFLOW_END - WORKFLOW_START)) | |
bash tg_utils.sh msg "gh $RUN_NUM: workflow ended in $((WDIFF / 60))m, $((WDIFF % 60))s" | |