Skip to content

Commit

Permalink
fix(build): Only copy if zephyr module detected
Browse files Browse the repository at this point in the history
* To fix issues with breakage with existing user config
  repos, only do our copy strategy if we detect a zephyr module
  present in the repo as well.
  • Loading branch information
petejohanson committed Dec 7, 2023
1 parent 384637a commit b90e683
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions .github/workflows/build-user-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ jobs:
shield: ${{ matrix.shield }}
artifact_name: ${{ matrix.artifact-name }}
run: |
export new_tmp_dir=$(mktemp -d)
echo "tmp_dir=${new_tmp_dir}" >> $GITHUB_ENV
echo "tmp_config_dir=${new_tmp_dir}/config" >> $GITHUB_ENV
if [ -e zephyr/module.yml ]; then
export zmk_load_arg=" -DZMK_EXTRA_MODULES='${GITHUB_WORKSPACE}'"
export new_tmp_dir=$(mktemp -d)
echo "base_dir=${new_tmp_dir}" >> $GITHUB_ENV
else
echo "base_dir=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
fi
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
Expand All @@ -80,8 +81,10 @@ jobs:
- name: Copy config files to isolated temporary directory
run: |
mkdir "${{ env.tmp_config_dir }}"
cp -R ${{ inputs.config_path }}/* "${{ env.tmp_config_dir }}/"
if [ "${{ env.base_dir }}" != "${GITHUB_WORKSPACE}" ]; then
mkdir "${{ env.base_dir }}/${{ inputs.config_path }}"
cp -R ${{ inputs.config_path }}/* "${{ env.base_dir }}/${{ inputs.config_path }}/"
fi
- name: Cache west modules
uses: actions/[email protected]
Expand All @@ -90,33 +93,33 @@ jobs:
cache_name: cache-zephyr-${{ env.zephyr_version }}-modules
with:
path: |
${{ env.tmp_dir }}/modules/
${{ env.tmp_dir }}/tools/
${{ env.tmp_dir }}/zephyr/
${{ env.tmp_dir }}/bootloader/
${{ env.tmp_dir }}/zmk/
${{ env.base_dir }}/modules/
${{ env.base_dir }}/tools/
${{ env.base_dir }}/zephyr/
${{ env.base_dir }}/bootloader/
${{ env.base_dir }}/zmk/
key: ${{ runner.os }}-build-${{ env.cache_name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache_name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: West Init
working-directory: ${{ env.tmp_dir }}
run: west init -l "${{ env.tmp_config_dir }}"
working-directory: ${{ env.base_dir }}
run: west init -l "${{ env.base_dir }}/${{ inputs.config_path }}"

- name: West Update
working-directory: ${{ env.tmp_dir }}
working-directory: ${{ env.base_dir }}
run: west update

- name: West Zephyr export
working-directory: ${{ env.tmp_dir }}
working-directory: ${{ env.base_dir }}
run: west zephyr-export

- name: West Build (${{ env.display_name }})
working-directory: ${{ env.tmp_dir }}
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.tmp_config_dir }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
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 }}

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

0 comments on commit b90e683

Please sign in to comment.