Update CI workflow to dynamically set keymaps (#26120)

This commit is contained in:
Joel Challis 2026-04-05 06:37:41 +01:00 committed by GitHub
parent 1426eedfc1
commit 933cb8cc35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 5 deletions

View File

@ -32,6 +32,7 @@ jobs:
container: ghcr.io/qmk/qmk_cli
outputs:
keymaps: ${{ steps.generate_slice_length.outputs.keymaps }}
slice_length: ${{ steps.generate_slice_length.outputs.slice_length }}
steps:
@ -47,12 +48,20 @@ jobs:
- name: Determine concurrency
id: generate_slice_length
shell: 'bash {0}'
run: |
target_count=$( {
qmk find -km default 2>/dev/null
qmk find -km xap 2>/dev/null
} | sort | uniq | wc -l)
targets=()
target_count=0
for target in "default" "xap"; do
count=$(qmk find -km $target 2>/dev/null | wc -l)
if [ $count -gt 0 ]; then
target_count=$(($target_count + $count))
targets+=($target)
fi
done
keymaps=$(jq -c -n '$ARGS.positional' --args "${targets[@]}")
slice_length=$((target_count / ($CONCURRENT_JOBS - 1))) # Err on the side of caution
echo "keymaps=$keymaps" >> $GITHUB_OUTPUT
echo "slice_length=$slice_length" >> $GITHUB_OUTPUT
build_targets:
@ -61,7 +70,7 @@ jobs:
strategy:
fail-fast: false
matrix:
keymap: [default, xap]
keymap: ${{ fromJson(needs.determine_concurrency.outputs.keymaps) }}
uses: ./.github/workflows/ci_build_major_branch_keymap.yml
with:
branch: ${{ inputs.branch || github.ref_name }}