From bc51a713f4a8a382df6a3c886d24aa10aec1bf40 Mon Sep 17 00:00:00 2001 From: Mikael Manukyan Date: Wed, 17 Jan 2024 11:43:51 -0800 Subject: [PATCH] update to zephyr 3.5 --- .github/workflows/build-user-config.yml | 89 ++++++++++++++++--------- config/west.yml | 2 +- 2 files changed, 57 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build-user-config.yml b/.github/workflows/build-user-config.yml index 5de28df..3dcdcb8 100644 --- a/.github/workflows/build-user-config.yml +++ b/.github/workflows/build-user-config.yml @@ -45,13 +45,23 @@ jobs: build: runs-on: ubuntu-latest container: - image: zmkfirmware/zmk-dev-arm:stable + image: zmkfirmware/zmk-dev-arm:3.5-branch needs: matrix name: Build strategy: fail-fast: false matrix: ${{ fromJson(needs.matrix.outputs.build_matrix) }} steps: + - name: Install adafruit-nrfutil + run: python3 -m pip install adafruit-nrfutil + + - name: Checkout + uses: actions/checkout@v3 + + - name: Create build directory + run: | + echo "build_dir=$(mktemp -d)" >> $GITHUB_ENV + - name: Prepare variables shell: sh -x {0} env: @@ -59,13 +69,25 @@ jobs: shield: ${{ matrix.shield }} artifact_name: ${{ matrix.artifact-name }} run: | + 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 - echo "extra_cmake_args=${shield:+-DSHIELD=\"$shield\"}" >> $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 - - name: Checkout - uses: actions/checkout@v3 + - name: Copy config files to isolated temporary directory + run: | + 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/cache@v3.0.11 @@ -74,11 +96,11 @@ jobs: cache_name: cache-zephyr-${{ env.zephyr_version }}-modules with: path: | - modules/ - tools/ - zephyr/ - bootloader/ - 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 }}- @@ -86,23 +108,30 @@ jobs: ${{ runner.os }}- - name: West Init - run: west init -l "${{ inputs.config_path }}" + working-directory: ${{ env.base_dir }} + run: west init -l "${{ env.base_dir }}/${{ inputs.config_path }}" - name: West Update + working-directory: ${{ env.base_dir }} run: west update - name: West Zephyr export + working-directory: ${{ env.base_dir }} run: west zephyr-export - name: West Build (${{ env.display_name }}) + working-directory: ${{ env.base_dir }} shell: sh -x {0} - run: west build -s zmk/app -b "${{ matrix.board }}" -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/${{ inputs.config_path }}" ${{ 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: Build DFU package + run: adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application "${{ env.build_dir }}/zephyr/zmk.uf2" "${{ env.build_dir }}/zephyr/dfu-package.zip" - name: ${{ env.display_name }} Kconfig file run: | - if [ -f build/zephyr/.config ] + if [ -f "${{ env.build_dir }}/zephyr/.config" ] then - grep -v -e "^#" -e "^$" build/zephyr/.config | sort + grep -v -e "^#" -e "^$" "${{ env.build_dir }}/zephyr/.config" | sort else echo "No Kconfig output" fi @@ -110,47 +139,41 @@ jobs: - name: ${{ env.display_name }} Devicetree file run: | - if [ -f build/zephyr/zephyr.dts ] + if [ -f "${{ env.build_dir }}/zephyr/zephyr.dts" ] then - cat build/zephyr/zephyr.dts - elif [ -f build/zephyr/zephyr.dts.pre ] + cat "${{ env.build_dir }}/zephyr/zephyr.dts" + elif [ -f "${{ env.build_dir }}/zephyr/zephyr.dts.pre" ] then - cat -s build/zephyr/zephyr.dts.pre + cat -s "${{ env.build_dir }}/zephyr/zephyr.dts.pre" else echo "No Devicetree output" fi if: ${{ !cancelled() }} - - name: Install adafruit-nrfutil - run: python3 -m pip install adafruit-nrfutil - - - name: Build DFU package - run: adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/zephyr/zmk.hex build/zephyr/dfu-package.zip - - name: Rename artifacts shell: sh -x {0} run: | - mkdir build/artifacts - if [ -f build/zephyr/zmk.uf2 ] + mkdir "${{ env.build_dir }}/artifacts" + if [ -f "${{ env.build_dir }}/zephyr/zmk.uf2" ] then - cp build/zephyr/zmk.uf2 "build/artifacts/${{ env.artifact_name }}.uf2" - elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ] + cp "${{ env.build_dir }}/zephyr/zmk.uf2" "${{ env.build_dir }}/artifacts/${{ env.artifact_name }}.uf2" + elif [ -f "${{ env.build_dir }}/zephyr/zmk.${{ inputs.fallback_binary }}" ] then - cp "build/zephyr/zmk.${{ inputs.fallback_binary }}" "build/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}" + cp "${{ env.build_dir }}/zephyr/zmk.${{ inputs.fallback_binary }}" "${{ env.build_dir }}/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}" fi - if [ -f build/zephyr/zmk.hex ] + if [ -f "${{ env.build_dir }}/zephyr/zmk.hex" ] then - cp build/zephyr/zmk.hex "build/artifacts/${{ env.artifact_name }}.hex" + cp "${{ env.build_dir }}/zephyr/zmk.hex" "${{ env.build_dir }}/artifacts/${{ env.artifact_name }}.hex" fi - if [ -f build/zephyr/dfu-package.zip ] + if [ -f "${{ env.build_dir }}/zephyr/dfu-package.zip" ] then - cp build/zephyr/dfu-package.zip "build/artifacts/${{ env.artifact_name }}-dfu.zip" + cp "${{ env.build_dir }}/zephyr/zmk.hex" "${{ env.build_dir }}/artifacts/${{ env.artifact_name }}-dfu.zip" fi - name: Archive (${{ env.display_name }}) uses: actions/upload-artifact@v3 with: name: ${{ inputs.archive_name }} - path: build/artifacts + path: ${{ env.build_dir }}/artifacts diff --git a/config/west.yml b/config/west.yml index f71d6af..ed69b70 100644 --- a/config/west.yml +++ b/config/west.yml @@ -5,7 +5,7 @@ manifest: projects: - name: zmk remote: zmkfirmware - revision: mm/experiments + revision: mm/zephyr3.5 import: app/west.yml self: path: config