Skip to content

Commit da1e1cf

Browse files
authored
feat: migrate to dynamic device matrix from configs/ (test-remote-action-build) (#9)
* feat: migrate to dynamic device matrix from configs/ Replace the hardcoded device matrix with a dynamic one loaded from JSON files in configs/. This allows easier maintenance and device onboarding without editing the workflow file. Also adds a new workflow_dispatch input 'op_model' to selectively build a single device This change improves scalability and user flexibility during manual workflow dispatch. * Rename OPAce5Pro to OP-ACE-5-PRO to align with other models * feat: migrate to unified JSON-based device config with dynamic field parsing This change refactors the entire kernel build pipeline to use a single JSON configuration per device instead of individual matrix inputs. Key improvements: - Workflow now passes the full matrix as op_config_json via toJSON(matrix) - All 26 device configs updated to include "hmbird" This enables true extensibility: new devices or config options require only a JSON file—no changes to the workflow or action logic. * Delete diff.patch
1 parent 1badf2f commit da1e1cf

27 files changed

+323
-18
lines changed

.github/workflows/build-kernel-release.yml

Lines changed: 89 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,38 @@ on:
1212
required: true
1313
type: boolean
1414
default: false
15+
op_model:
16+
description: 'Select the OnePlus kernels to build'
17+
required: true
18+
type: choice
19+
options:
20+
- OP13-CPH
21+
- OP13-PJZ
22+
- OP13r
23+
- OP13S
24+
- OP13T
25+
- OP12
26+
- OP12r
27+
- OP11
28+
- OP11r
29+
- OP10pro
30+
- OP10t
31+
- OP-Nord-5
32+
- OP-NORD-4
33+
- OP-NORD-4-CE
34+
- OP-NORD-CE4-LITE
35+
- OP-ACE-5-PRO
36+
- OP-ACE-5
37+
- OP-ACE-3-PRO
38+
- OP-ACE-3V
39+
- OP-ACE-2-PRO
40+
- OP-ACE-2
41+
- OP-OPEN
42+
- OP-PAD-3
43+
- OP-PAD-2-PRO
44+
- OP-PAD-2
45+
- OP-PAD-PRO
46+
default: OP11
1547
ksun_branch:
1648
description: 'Enter KernelSU Next Branch or commit hash (blank for stable tag)'
1749
required: true
@@ -49,20 +81,64 @@ on:
4981
default: ''
5082

5183
jobs:
84+
set-op-model:
85+
runs-on: ubuntu-latest
86+
outputs:
87+
matrix: ${{ steps.set-matrix.outputs.matrix }}
88+
steps:
89+
- name: Checkout Code (to access configs/)
90+
uses: actions/checkout@v4
91+
with:
92+
sparse-checkout: |
93+
configs/
94+
sparse-checkout-cone-mode: false
95+
96+
- name: Setup OnePlus Model
97+
id: set-matrix
98+
shell: bash
99+
run: |
100+
set -euo pipefail
101+
declare -a models=()
102+
while IFS= read -r -d '' file; do
103+
model=$(basename "$file" .json)
104+
models+=("$model")
105+
done < <(find configs/ -name "*.json" -print0)
106+
107+
if [ ${#models[@]} -eq 0 ]; then
108+
echo "Error: No config files found in configs/ directory!"
109+
exit 1
110+
fi
111+
112+
echo "[" > matrix.json
113+
for i in "${!models[@]}"; do
114+
model="${models[$i]}"
115+
file="configs/$model.json"
116+
if [ -f "$file" ]; then
117+
jq -r '.' "$file" >> matrix.json
118+
if [ $((i+1)) -lt ${#models[@]} ]; then
119+
echo "," >> matrix.json
120+
fi
121+
fi
122+
done
123+
echo "]" >> matrix.json
124+
125+
input="${{ github.event.inputs.op_model }}"
126+
jq_filter="map(select(.model == \"$input\"))"
127+
128+
filtered=$(jq -c "$jq_filter" matrix.json)
129+
wrapped=$(jq -n --argjson items "$filtered" '{ include: $items }')
130+
131+
echo "matrix<<MATRIX_EOF" >> "$GITHUB_OUTPUT"
132+
echo "$wrapped" >> "$GITHUB_OUTPUT"
133+
echo "MATRIX_EOF" >> "$GITHUB_OUTPUT"
134+
52135
build:
53136
name: build (${{ matrix.model }}, ${{ matrix.soc }}, ${{ matrix.branch }}, ${{ matrix.manifest }}, ${{ matrix.android_version }}, ${{ matrix.kernel_version }}, ${{ inputs.ksun_branch }})
137+
needs: set-op-model
54138
runs-on: ubuntu-latest
55139
strategy:
56140
fail-fast: false
57-
matrix:
58-
include:
59-
- model: OP11
60-
soc: kalama
61-
branch: oneplus/sm8550
62-
manifest: oneplus_11_v.xml
63-
android_version: android13
64-
kernel_version: '5.15'
65-
141+
matrix: ${{ fromJSON(needs.set-op-model.outputs.matrix) }}
66142
steps:
67143
- name: Resolve SUSFS branch from inputs
68144
id: susfs
@@ -78,7 +154,6 @@ jobs:
78154
["android14-6.1"]="${{ inputs.android14-6_1_susfs_branch_or_commit }}"
79155
["android15-6.6"]="${{ inputs.android15-6_6_susfs_branch_or_commit }}"
80156
)
81-
# Only validate mapping presence; allow empty string value to be passed through.
82157
if [[ -z "${map[$key]+_exists}" ]]; then
83158
echo "Unsupported combo (no mapping): $key" >&2
84159
exit 1
@@ -93,10 +168,7 @@ jobs:
93168
- name: Build Kernel
94169
uses: WildKernels/OnePlus_KernelSU_SUSFS/.github/actions@main
95170
with:
96-
model: ${{ matrix.model }}
97-
soc: ${{ matrix.soc }}
98-
branch: ${{ matrix.branch }}
99-
manifest: ${{ matrix.manifest }}
171+
op_config_json: ${{ toJSON(matrix) }}
100172
ksun_branch: ${{ inputs.ksun_branch }}
101173
susfs_commit_hash_or_branch: ${{ steps.susfs.outputs.susfs_branch }}
102174
optimize_level: ${{ inputs.optimize_level }}
@@ -115,10 +187,10 @@ jobs:
115187
116188
Module:
117189
-> https://github.com/sidex15/ksu_module_susfs
118-
190+
119191
Non-Official Managers:
120192
-> https://github.com/KernelSU-Next/KernelSU-Next
121-
193+
122194
Features:
123195
[+] KernelSU-Next / WildKSU Manager Support
124196
[+] SUSFS v1.5.12
@@ -130,7 +202,6 @@ jobs:
130202
[+] BBR v1 Support.
131203
[+] HMBIRD scx support for OnePlus 13 & OnePlus Ace 5 Pro.
132204
[+] Baseband Guard Support (BBG).
133-
[+] xx_maps hide.
134205
135206
steps:
136207
- name: Checkout code
@@ -182,4 +253,4 @@ jobs:
182253
- name: Display Files Uploaded
183254
run: |
184255
echo "GitHub release created with the following files:"
185-
ls ./downloaded-artifacts/**/*
256+
ls ./downloaded-artifacts/**/*

configs/OP-ACE-2-PRO.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"model": "OP-ACE-2-PRO",
3+
"soc": "kalama",
4+
"branch": "oneplus/sm8550",
5+
"manifest": "oneplus_ace2_pro_v.xml",
6+
"android_version": "android13",
7+
"kernel_version": "5.15",
8+
"hmbird": false
9+
}

configs/OP-ACE-2.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"model": "OP-ACE-2",
3+
"soc": "waipio",
4+
"branch": "oneplus/sm8475",
5+
"manifest": "oneplus_ace2_v.xml",
6+
"android_version": "android12",
7+
"kernel_version": "5.10",
8+
"hmbird": false
9+
}

configs/OP-ACE-3-PRO.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"model": "OP-ACE-3-PRO",
3+
"soc": "pineapple",
4+
"branch": "oneplus/sm8650",
5+
"manifest": "oneplus_ace3_pro_v.xml",
6+
"android_version": "android14",
7+
"kernel_version": "6.1",
8+
"hmbird": false
9+
}

configs/OP-ACE-3V.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"model": "OP-ACE-3V",
3+
"soc": "pineapple",
4+
"branch": "oneplus/sm7675",
5+
"manifest": "oneplus_ace_3v_v.xml",
6+
"android_version": "android14",
7+
"kernel_version": "6.1",
8+
"hmbird": false
9+
}

configs/OP-ACE-5-PRO.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"model": "OP-ACE-5-PRO",
3+
"soc": "sun",
4+
"branch": "oneplus/sm8750",
5+
"manifest": "oneplus_ace5_pro.xml",
6+
"android_version": "android15",
7+
"kernel_version": "6.6",
8+
"hmbird": true
9+
}

configs/OP-ACE-5.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"model": "OP-ACE-5",
3+
"soc": "pineapple",
4+
"branch": "oneplus/sm8650",
5+
"manifest": "oneplus_ace5.xml",
6+
"android_version": "android14",
7+
"kernel_version": "6.1",
8+
"hmbird": false
9+
}

configs/OP-NORD-4-CE.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"model": "OP-NORD-4-CE",
3+
"soc": "crow",
4+
"branch": "oneplus/sm7550",
5+
"manifest": "oneplus_nord_ce4_v.xml",
6+
"android_version": "android13",
7+
"kernel_version": "5.15",
8+
"hmbird": false
9+
}

configs/OP-NORD-4.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"model": "OP-NORD-4",
3+
"soc": "pineapple",
4+
"branch": "oneplus/sm7675",
5+
"manifest": "oneplus_nord_4_v.xml",
6+
"android_version": "android14",
7+
"kernel_version": "6.1",
8+
"hmbird": false
9+
}

configs/OP-NORD-5.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"model": "OP-NORD-5",
3+
"soc": "cliffs",
4+
"branch": "oneplus/sm8635",
5+
"manifest": "oneplus_nord_5.xml",
6+
"android_version": "android14",
7+
"kernel_version": "6.1",
8+
"hmbird": false
9+
}

0 commit comments

Comments
 (0)