ci: build lkm only if needed while building manager
This commit is contained in:
33
.github/workflows/build-lkm.yml
vendored
33
.github/workflows/build-lkm.yml
vendored
@@ -1,17 +1,23 @@
|
|||||||
name: Build LKM for KernelSU
|
name: Build LKM for KernelSU
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: ["main", "ci", "checkci"]
|
|
||||||
paths:
|
|
||||||
- ".github/workflows/build-lkm.yml"
|
|
||||||
- 'kernel/**'
|
|
||||||
pull_request:
|
|
||||||
branches: ["main"]
|
|
||||||
paths:
|
|
||||||
- ".github/workflows/build-lkm.yml"
|
|
||||||
- 'kernel/**'
|
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
upload:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
description: "Whether to upload to branch"
|
||||||
|
secrets:
|
||||||
|
# username:github_pat
|
||||||
|
TOKEN:
|
||||||
|
required: true
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
upload:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
description: "Whether to upload to branch"
|
||||||
jobs:
|
jobs:
|
||||||
build-lkm:
|
build-lkm:
|
||||||
strategy:
|
strategy:
|
||||||
@@ -35,6 +41,7 @@ jobs:
|
|||||||
- version: "android15-6.6"
|
- version: "android15-6.6"
|
||||||
sub_level: 57
|
sub_level: 57
|
||||||
os_patch_level: 2024-12
|
os_patch_level: 2024-12
|
||||||
|
# uses: ./.github/workflows/gki-kernel-mock.yml when debugging
|
||||||
uses: ./.github/workflows/gki-kernel.yml
|
uses: ./.github/workflows/gki-kernel.yml
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
@@ -43,10 +50,10 @@ jobs:
|
|||||||
os_patch_level: ${{ matrix.os_patch_level }}
|
os_patch_level: ${{ matrix.os_patch_level }}
|
||||||
build_lkm: true
|
build_lkm: true
|
||||||
|
|
||||||
|
|
||||||
push-to-branch:
|
push-to-branch:
|
||||||
needs: [build-lkm]
|
needs: [build-lkm]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ inputs.upload }}
|
||||||
steps:
|
steps:
|
||||||
- name: Download all workflow run artifacts
|
- name: Download all workflow run artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -58,10 +65,10 @@ jobs:
|
|||||||
cd bin
|
cd bin
|
||||||
git config --global init.defaultBranch lkm
|
git config --global init.defaultBranch lkm
|
||||||
git init
|
git init
|
||||||
git remote add origin https://${{ github.actor }}:${{ secrets.TOKEN }}@github.com/${{ github.repository }}
|
git remote add origin https://${{ secrets.TOKEN }}@github.com/${{ github.repository }}
|
||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "github-actions[bot]"
|
||||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
find . -type f
|
find . -type f
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Upload LKM"
|
git commit -m "Upload LKM from ${{ github.sha }}" -m "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||||
git push --force --set-upstream origin lkm
|
git push --force --set-upstream origin lkm
|
||||||
|
|||||||
72
.github/workflows/build-manager.yml
vendored
72
.github/workflows/build-manager.yml
vendored
@@ -12,9 +12,79 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'manager/**'
|
- 'manager/**'
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
build_lkm:
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
default: "auto"
|
||||||
|
options:
|
||||||
|
- "true"
|
||||||
|
- "false"
|
||||||
|
- "auto"
|
||||||
|
description: "Whether to build lkm"
|
||||||
|
upload_lkm:
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
description: "Whether to upload lkm"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check-build-lkm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
build_lkm: ${{ steps.check-build.outputs.build_lkm }}
|
||||||
|
upload_lkm: ${{ steps.check-build.outputs.upload_lkm }}
|
||||||
|
steps:
|
||||||
|
- name: check build
|
||||||
|
id: check-build
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ "${{ inputs.build_lkm }}" != "auto" ]; then
|
||||||
|
kernel_changed="${{ inputs.build_lkm }}"
|
||||||
|
else
|
||||||
|
kernel_changed=true
|
||||||
|
mkdir tmp
|
||||||
|
cd tmp
|
||||||
|
git config --global init.defaultBranch bot
|
||||||
|
git config --global user.name 'Bot'
|
||||||
|
git config --global user.email 'bot@github.5ec1cff.io'
|
||||||
|
git init .
|
||||||
|
git remote add origin https://github.com/${{ github.repository }}
|
||||||
|
CURRENT_COMMIT="${{ github.event.head_commit.id }}"
|
||||||
|
git fetch origin $CURRENT_COMMIT --depth=1
|
||||||
|
git fetch origin lkm --depth=1
|
||||||
|
LKM_COMMIT="$(git log --format=%B -n 1 origin/lkm | head -n 1)"
|
||||||
|
LKM_COMMIT="${LKM_COMMIT#Upload LKM from }"
|
||||||
|
LKM_COMMIT=$(echo "$LKM_COMMIT" | tr -d '[:space:]')
|
||||||
|
echo "LKM_COMMIT=$LKM_COMMIT"
|
||||||
|
git fetch origin "$LKM_COMMIT" --depth=1
|
||||||
|
git diff --quiet "$LKM_COMMIT" "$CURRENT_COMMIT" -- kernel :!kernel/setup.sh .github/workflows/build-lkm.yml .github/workflows/build-kernel-*.yml && kernel_changed=false
|
||||||
|
cd ..
|
||||||
|
rm -rf tmp
|
||||||
|
fi
|
||||||
|
if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == 'refs/heads/main' ]; then
|
||||||
|
need_upload=true
|
||||||
|
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||||||
|
need_upload="${{ inputs.upload_lkm }}"
|
||||||
|
else
|
||||||
|
need_upload=false
|
||||||
|
fi
|
||||||
|
echo "kernel changed: $kernel_changed"
|
||||||
|
echo "need upload: $need_upload"
|
||||||
|
echo "build_lkm=$kernel_changed" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "upload_lkm=$need_upload" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
build-lkm:
|
||||||
|
needs: check-build-lkm
|
||||||
|
uses: ./.github/workflows/build-lkm.yml
|
||||||
|
if: ${{ needs.check-build-lkm.outputs.build_lkm == 'true' }}
|
||||||
|
with:
|
||||||
|
upload: ${{ needs.check-build-lkm.outputs.upload_lkm == 'true' }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
build-ksud:
|
build-ksud:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: [ check-build-lkm, build-lkm ]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@@ -27,8 +97,10 @@ jobs:
|
|||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
os: ${{ matrix.os }}
|
os: ${{ matrix.os }}
|
||||||
pack_lkm: true
|
pack_lkm: true
|
||||||
|
pull_lkm: ${{ needs.check-build-lkm.outputs.build_lkm != 'true' }}
|
||||||
|
|
||||||
build-manager:
|
build-manager:
|
||||||
|
if: ${{ always() }}
|
||||||
needs: build-ksud
|
needs: build-ksud
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
defaults:
|
||||||
|
|||||||
79
.github/workflows/gki-kernel-mock.yml
vendored
Normal file
79
.github/workflows/gki-kernel-mock.yml
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
name: GKI Kernel Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
Output directory of gki,
|
||||||
|
for example: android12-5.10
|
||||||
|
version_name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
With SUBLEVEL of kernel,
|
||||||
|
for example: android12-5.10.66
|
||||||
|
tag:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
Part of branch name of common kernel manifest,
|
||||||
|
for example: android12-5.10-2021-11
|
||||||
|
os_patch_level:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
Patch level of common kernel manifest,
|
||||||
|
for example: 2021-11
|
||||||
|
default: 2022-05
|
||||||
|
patch_path:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
description: >
|
||||||
|
Directory name of .github/patches/<patch_path>
|
||||||
|
for example: 5.10
|
||||||
|
use_cache:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
embed_ksud:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ksud-aarch64-linux-android
|
||||||
|
description: >
|
||||||
|
Artifact name of prebuilt ksud to be embedded
|
||||||
|
for example: ksud-aarch64-linux-android
|
||||||
|
debug:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
build_lkm:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
secrets:
|
||||||
|
BOOT_SIGN_KEY:
|
||||||
|
required: false
|
||||||
|
CHAT_ID:
|
||||||
|
required: false
|
||||||
|
BOT_TOKEN:
|
||||||
|
required: false
|
||||||
|
MESSAGE_THREAD_ID:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
mock_build:
|
||||||
|
name: Mock build ${{ inputs.version_name }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Create mocking ko
|
||||||
|
run: |
|
||||||
|
echo "${{ inputs.version }}_kernelsu.ko" > ${{ inputs.version }}_kernelsu.ko
|
||||||
|
- name: Upload LKM
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
if: ${{ inputs.build_lkm == true }}
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.version }}-lkm
|
||||||
|
path: ./*_kernelsu.ko
|
||||||
21
.github/workflows/ksud.yml
vendored
21
.github/workflows/ksud.yml
vendored
@@ -9,6 +9,10 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: ubuntu-latest
|
default: ubuntu-latest
|
||||||
|
pull_lkm:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
pack_lkm:
|
pack_lkm:
|
||||||
required: false
|
required: false
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -25,18 +29,27 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Download Pre-built LKMs
|
- name: Pull lkms from branch
|
||||||
if: ${{ inputs.pack_lkm }}
|
if: ${{ inputs.pack_lkm && inputs.pull_lkm }}
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: lkm
|
ref: lkm
|
||||||
path: lkm
|
path: lkm
|
||||||
|
|
||||||
- name: Prepare LKM fies
|
- name: Download lkms from artifacts
|
||||||
if: ${{ inputs.pack_lkm }}
|
if: ${{ inputs.pack_lkm && !inputs.pull_lkm }}
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
|
- name: Prepare LKM files
|
||||||
|
if: ${{ inputs.pack_lkm && inputs.pull_lkm }}
|
||||||
run: |
|
run: |
|
||||||
cp lkm/*_kernelsu.ko ./userspace/ksud/bin/aarch64/
|
cp lkm/*_kernelsu.ko ./userspace/ksud/bin/aarch64/
|
||||||
|
|
||||||
|
- name: Prepare LKM files
|
||||||
|
if: ${{ inputs.pack_lkm && !inputs.pull_lkm }}
|
||||||
|
run: |
|
||||||
|
cp android*-lkm/*_kernelsu.ko ./userspace/ksud/bin/aarch64/
|
||||||
|
|
||||||
- name: Setup rustup
|
- name: Setup rustup
|
||||||
run: |
|
run: |
|
||||||
rustup update stable
|
rustup update stable
|
||||||
|
|||||||
Reference in New Issue
Block a user