|
| 1 | +name: Build OpenThread for Raytac MDBT50Q-CX-40 |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - build-raytac |
| 8 | + - build-raytec |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + name: Build Zephyr OpenThread samples (Raytac dongle) |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + env: |
| 20 | + BOARD: raytac_mdbt50q_cx_40_dongle/nrf52840 |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Set up Python |
| 27 | + uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: "3.12" |
| 30 | + |
| 31 | + # Sets up a Zephyr workspace, installs west, and pulls Zephyr + modules. |
| 32 | + - name: Set up Zephyr workspace |
| 33 | + uses: zephyrproject-rtos/action-zephyr-setup@v1 |
| 34 | + with: |
| 35 | + # Pinning is optional; leaving this out follows the action default. |
| 36 | + sdk-version: "0.17.2" |
| 37 | + toolchains: arm-zephyr-eabi |
| 38 | + |
| 39 | + # Make sure the toolchain is actually usable in later steps (fixes gcc not found). |
| 40 | + - name: Put Zephyr SDK toolchain on PATH |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + echo "${ZEPHYR_SDK_INSTALL_DIR}/arm-zephyr-eabi/bin" >> "${GITHUB_PATH}" |
| 44 | +
|
| 45 | + # Fix the protobuf/nrfutil breakage (optional, but avoids your current crash). |
| 46 | + - name: Install nrfutil (protobuf pinned) |
| 47 | + shell: bash |
| 48 | + run: | |
| 49 | + python -m pip install --upgrade pip |
| 50 | + python -m pip install "protobuf==3.20.*" "nrfutil" |
| 51 | +
|
| 52 | + - name: Create west manifest (repo root) |
| 53 | + run: | |
| 54 | + cat > west.yml <<'YML' |
| 55 | + manifest: |
| 56 | + remotes: |
| 57 | + - name: zephyrproject-rtos |
| 58 | + url-base: https://github.com/zephyrproject-rtos |
| 59 | + projects: |
| 60 | + - name: zephyr |
| 61 | + remote: zephyrproject-rtos |
| 62 | + revision: v4.2.0 |
| 63 | + import: true |
| 64 | + self: |
| 65 | + path: . |
| 66 | + YML |
| 67 | +
|
| 68 | + - name: Print tool versions |
| 69 | + shell: bash |
| 70 | + run: | |
| 71 | + west --version |
| 72 | + cmake --version |
| 73 | + ninja --version |
| 74 | + arm-zephyr-eabi-gcc --version | head -n 1 |
| 75 | + nrfutil --version || true |
| 76 | +
|
| 77 | + # IMPORTANT: build from the Zephyr repo root, and use samples/... paths. |
| 78 | + - name: Build OpenThread shell (UART) -> ot-cli-ftd-UART |
| 79 | + working-directory: ${{ env.ZEPHYR_BASE }} |
| 80 | + shell: bash |
| 81 | + run: | |
| 82 | + west build -p always \ |
| 83 | + -b "${BOARD}" \ |
| 84 | + -d "${{ github.workspace }}/build/ot-cli-ftd-UART" \ |
| 85 | + samples/net/openthread/shell -- \ |
| 86 | + -DCONF_FILE="prj.conf" |
| 87 | +
|
| 88 | + # USB console: use Zephyr's snippet that redirects console to CDC-ACM. |
| 89 | + # (This is the cleanest way to get a USB serial console on many boards.) |
| 90 | + - name: Build OpenThread shell (USB CDC-ACM console) -> ot-cli-ftd-USB |
| 91 | + working-directory: ${{ env.ZEPHYR_BASE }} |
| 92 | + shell: bash |
| 93 | + run: | |
| 94 | + west build -p always \ |
| 95 | + -S cdc-acm-console \ |
| 96 | + -b "${BOARD}" \ |
| 97 | + -d "${{ github.workspace }}/build/ot-cli-ftd-USB" \ |
| 98 | + samples/net/openthread/shell -- \ |
| 99 | + -DCONF_FILE="prj.conf" |
| 100 | +
|
| 101 | + # RCP build: Zephyr provides a coprocessor sample and an RCP overlay. |
| 102 | + # USB transport example uses usb.overlay + overlay-usb-nrf-br.conf. |
| 103 | + - name: Build OpenThread RCP (USB CDC-ACM UART transport) -> ot-rcp-USB |
| 104 | + working-directory: ${{ env.ZEPHYR_BASE }} |
| 105 | + shell: bash |
| 106 | + run: | |
| 107 | + west build -p always \ |
| 108 | + -b "${BOARD}" \ |
| 109 | + -d "${{ github.workspace }}/build/ot-rcp-USB" \ |
| 110 | + samples/net/openthread/coprocessor -- \ |
| 111 | + -DCONF_FILE="prj.conf overlay-rcp.conf" \ |
| 112 | + -DDTC_OVERLAY_FILE="usb.overlay" \ |
| 113 | + -DEXTRA_CONF_FILE="overlay-usb-nrf-br.conf" |
| 114 | +
|
| 115 | + - name: Collect artifacts (hex/bin/uf2 if present) |
| 116 | + shell: bash |
| 117 | + run: | |
| 118 | + set -euo pipefail |
| 119 | + mkdir -p out |
| 120 | +
|
| 121 | + collect() { |
| 122 | + local builddir="$1" |
| 123 | + local name="$2" |
| 124 | +
|
| 125 | + cp "${builddir}/zephyr/zephyr.hex" "out/${name}.hex" |
| 126 | + cp "${builddir}/zephyr/zephyr.bin" "out/${name}.bin" |
| 127 | +
|
| 128 | + # UF2 is not always produced for every board; copy if it exists. |
| 129 | + if [ -f "${builddir}/zephyr/zephyr.uf2" ]; then |
| 130 | + cp "${builddir}/zephyr/zephyr.uf2" "out/${name}.uf2" |
| 131 | + fi |
| 132 | + } |
| 133 | +
|
| 134 | + collect "${{ github.workspace }}/build/ot-cli-ftd-UART" "ot-cli-ftd-UART" |
| 135 | + collect "${{ github.workspace }}/build/ot-cli-ftd-USB" "ot-cli-ftd-USB" |
| 136 | + collect "${{ github.workspace }}/build/ot-rcp-USB" "ot-rcp-USB" |
| 137 | +
|
| 138 | + ls -lah out |
| 139 | +
|
| 140 | + - name: Upload artifacts |
| 141 | + uses: actions/upload-artifact@v4 |
| 142 | + with: |
| 143 | + name: raytac-mdbt50q-cx-40-openthread |
| 144 | + path: out/* |
| 145 | + |
0 commit comments