Skip to content

Commit

Permalink
feat(build): Allow specifying snippets for a build.
Browse files Browse the repository at this point in the history
* Allow using snippets https://docs.zephyrproject.org/latest/build/snippets/using.html
  for user builds in a `snippets` array propertly.
  • Loading branch information
petejohanson committed Mar 24, 2024
1 parent 4435879 commit e419c60
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/build-user-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,16 @@ jobs:
run: |
echo "build_dir=$(mktemp -d)" >> $GITHUB_ENV
- name: Install yaml2json
run: apt-get update && apt-get install -y jq python3-pip && python3 -m pip install remarshal

- name: Prepare variables
shell: sh -x {0}
env:
board: ${{ matrix.board }}
shield: ${{ matrix.shield }}
artifact_name: ${{ matrix.artifact-name }}
job_index: ${{ strategy.job-index }}
run: |
if [ -e zephyr/module.yml ]; then
export zmk_load_arg=" -DZMK_EXTRA_MODULES='${GITHUB_WORKSPACE}'"
Expand All @@ -75,7 +79,11 @@ jobs:
echo "base_dir=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
fi
# Pull the snippets array for each matrix entry, and create a single string from it
extra_west_args=$(yaml2json "${{ inputs.build_matrix_path }}" | jq -r -c ".include[${job_index}].snippets | map(\"-S \" +.) | join(\" \")")
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
echo "extra_west_args=${extra_west_args}" >> $GITHUB_ENV
echo "extra_cmake_args=${shield:+-DSHIELD=\"$shield\"}${zmk_load_arg}" >> $GITHUB_ENV
echo "display_name=${shield:+$shield - }${board}" >> $GITHUB_ENV
echo "artifact_name=${artifact_name:-${shield:+$shield-}${board}-zmk}" >> $GITHUB_ENV
Expand Down Expand Up @@ -120,7 +128,7 @@ jobs:
- name: West Build (${{ env.display_name }})
working-directory: ${{ env.base_dir }}
shell: sh -x {0}
run: west build -s zmk/app -d "${{ env.build_dir }}" -b "${{ matrix.board }}" -- -DZMK_CONFIG=${{ env.base_dir }}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
run: west build -s zmk/app -d "${{ env.build_dir }}" -b "${{ matrix.board }}" ${{ env.extra_west_args }} -- -DZMK_CONFIG=${{ env.base_dir }}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}

- name: ${{ env.display_name }} Kconfig file
run: |
Expand Down

0 comments on commit e419c60

Please sign in to comment.