Merge branch 'dev' #279
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.event.pull_request.head.sha || github.ref }} | |
| cancel-in-progress: true | |
| permissions: write-all | |
| env: | |
| ZEPHYR_SDK_VERSION: "0.16.9" | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| sdk-hash: ${{ steps.generate-vars.outputs.sdk-hash }} | |
| sdk-revision: ${{ steps.generate-vars.outputs.sdk-revision }} | |
| repo: ${{ steps.generate-vars.outputs.repo }} | |
| repo-url: ${{ steps.generate-vars.outputs.repo-url }} | |
| branch: ${{ steps.generate-vars.outputs.branch }} | |
| repo-hash: ${{ steps.generate-vars.outputs.repo-hash }} | |
| steps: | |
| - name: π» Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| path: zephyr-workspace/SlimeNRF-CI | |
| submodules: recursive | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: π Generate CI Variables | |
| id: generate-vars | |
| run: | | |
| WEST_FILE="west.yml" | |
| if [ -f "$WEST_FILE" ]; then | |
| echo "Found west.yml in the root directory" | |
| elif [ -f "zephyr-workspace/$WEST_FILE" ]; then | |
| WEST_FILE="zephyr-workspace/$WEST_FILE" | |
| echo "Found west.yml in zephyr-workspace" | |
| elif [ -f "zephyr-workspace/SlimeNRF-CI/$WEST_FILE" ]; then | |
| WEST_FILE="zephyr-workspace/SlimeNRF-CI/$WEST_FILE" | |
| echo "Found west.yml in zephyr-workspace/SlimeNRF-CI" | |
| else | |
| echo "Error: west.yml not found!" >&2 | |
| exit 1 | |
| fi | |
| SDK_URL=$(yq -r '.manifest.projects[] | select(.name=="sdk-nrf") | .url' "$WEST_FILE") | |
| SDK_REVISION=$(yq -r '.manifest.projects[] | select(.name=="sdk-nrf") | .revision' "$WEST_FILE") | |
| SDK_COMMIT=$(git ls-remote "$SDK_URL" "$SDK_REVISION" | awk '{print $1}') | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| REPO="${{ github.event.pull_request.head.repo.full_name }}" | |
| REPO_URL="${{ github.event.pull_request.head.repo.clone_url }}" | |
| BRANCH="${{ github.event.pull_request.head.ref }}" | |
| REPO_COMMIT="${{ github.event.pull_request.head.sha }}" | |
| else | |
| REPO="$GITHUB_REPOSITORY" | |
| REPO_URL="https://github.com/$GITHUB_REPOSITORY.git" | |
| BRANCH="${GITHUB_REF#refs/heads/}" | |
| REPO_COMMIT="$GITHUB_SHA" | |
| fi | |
| echo "sdk-hash=$SDK_COMMIT" >> "$GITHUB_OUTPUT" | |
| echo "sdk-revision=$SDK_REVISION" >> "$GITHUB_OUTPUT" | |
| echo "repo=$REPO" >> "$GITHUB_OUTPUT" | |
| echo "repo-url=$REPO_URL" >> "$GITHUB_OUTPUT" | |
| echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" | |
| echo "repo-hash=$REPO_COMMIT" >> "$GITHUB_OUTPUT" | |
| - name: π§° Cache + Install Apt Dependencies | |
| id: cache-apt | |
| uses: awalsh128/cache-apt-pkgs-action@latest | |
| with: | |
| packages: >- | |
| git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget | |
| python3-dev python3-pip python3-setuptools python3-tk python3-wheel python3-venv | |
| xz-utils file make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 | |
| version: 1.0 | |
| - name: π¦ Cache Zephyr SDK | |
| id: cache-sdk | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }} | |
| key: zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }} | |
| - name: πͺ Install Zephyr SDK | |
| id: install-sdk | |
| if: steps.cache-sdk.outputs.cache-hit != 'true' | |
| run: | | |
| wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${{ env.ZEPHYR_SDK_VERSION }}/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }}_linux-x86_64_minimal.tar.xz | |
| tar xf zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }}_linux-x86_64_minimal.tar.xz -C ~/ | |
| ~/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }}/setup.sh -c -t arm-zephyr-eabi | |
| - name: π¦ Cache West Workspace | |
| id: cache-west | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| zephyr-workspace/.west | |
| zephyr-workspace/zephyr | |
| zephyr-workspace/nrf | |
| zephyr-workspace/modules | |
| zephyr-workspace/nrfxlib | |
| zephyr-workspace/bootloader | |
| zephyr-workspace/tools | |
| key: west-workspace-${{ steps.generate-vars.outputs.sdk-hash }} | |
| - name: π¦ Cache PIP Requirements | |
| id: cache-pip | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.venv | |
| key: venv-pip-${{ env.ZEPHYR_SDK_VERSION }} | |
| - name: π¦ Restore Python venv | |
| if: steps.cache-pip.outputs.cache-hit != 'true' | |
| id: restore-venv | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ~/.venv | |
| key: venv-${{ env.ZEPHYR_SDK_VERSION }} | |
| - name: π Setup Python venv + West | |
| id: setup-venv | |
| if: ${{ steps.cache-pip.outputs.cache-hit != 'true' && steps.restore-venv.outputs.cache-hit != 'true' }} | |
| run: | | |
| python3 -m venv ~/.venv | |
| ~/.venv/bin/pip install west ninja | |
| - name: π¦ Cache Python venv | |
| if: steps.restore-venv.outputs.cache-hit != 'true' | |
| id: cache-venv | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: ~/.venv | |
| key: venv-${{ env.ZEPHYR_SDK_VERSION }} | |
| - name: β»οΈ Initialize Zephyr Workspace | |
| id: init-west | |
| run: | | |
| echo "$HOME/.venv/bin" >> $GITHUB_PATH | |
| export PATH="$HOME/.venv/bin:$PATH" | |
| cd zephyr-workspace | |
| if [ ! -d ".west" ]; then | |
| west init -l SlimeNRF-CI | |
| fi | |
| west update --narrow -o=--depth=1 | |
| west zephyr-export | |
| - name: π Install Zephyr Python Requirements | |
| id: install-pip | |
| if: steps.cache-pip.outputs.cache-hit != 'true' | |
| run: | | |
| cd zephyr-workspace | |
| ~/.venv/bin/pip install -r zephyr/scripts/requirements.txt | |
| - name: π¦ Cache Repository | |
| id: cache-repository | |
| uses: actions/cache@v5 | |
| with: | |
| path: zephyr-workspace/SlimeVR-Tracker-nRF | |
| key: firmware-${{ steps.generate-vars.outputs.repo-hash }} | |
| - name: π₯ Clone Repository | |
| id: clone-repository | |
| if: steps.cache-repository.outputs.cache-hit != 'true' | |
| run: | | |
| cd zephyr-workspace | |
| rm -rf SlimeVR-Tracker-nRF | |
| git clone --filter=blob:none --no-checkout "${{ steps.generate-vars.outputs.repo-url }}" SlimeVR-Tracker-nRF | |
| git -C SlimeVR-Tracker-nRF fetch --depth=1 origin "${{ steps.generate-vars.outputs.repo-hash }}" | |
| git -C SlimeVR-Tracker-nRF checkout "${{ steps.generate-vars.outputs.repo-hash }}" | |
| git -C SlimeVR-Tracker-nRF submodule update --init --recursive --depth 1 | |
| build: | |
| needs: setup | |
| continue-on-error: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| boards: [ | |
| {boardname: "promicro_uf2/nrf52840/i2c", fileformat: "uf2", filename: "SlimeNRF_ProMicro_I2C_Tracker"}, | |
| {boardname: "promicro_uf2/nrf52840/spi", fileformat: "uf2", filename: "SlimeNRF_ProMicro_SPI_Tracker"}, | |
| {boardname: "promicro_uf2/nrf52840/smspi", fileformat: "uf2", filename: "SlimeNRF_ProMicro_smSPI_Tracker"}, | |
| {boardname: "promicro_uf2/nrf52840/chrysalis", fileformat: "uf2", filename: "SlimeNRF_ProMicro_Chrysalis_Tracker"}, | |
| {boardname: "xiao_ble/nrf52840", fileformat: "uf2", filename: "SlimeNRF_XIAO_Tracker"}, | |
| {boardname: "xiao_ble/nrf52840/sense", fileformat: "uf2", filename: "SlimeNRF_XIAO_Sense_Tracker"}, | |
| {boardname: "slimenrf_r1/nrf52840", fileformat: "hex", filename: "SlimeNRF_slimenrf_r1_Tracker"}, | |
| {boardname: "slimenrf_r2/nrf52832", fileformat: "hex", filename: "SlimeNRF_slimenrf_r2_Tracker"}, | |
| {boardname: "slimenrf_r3/nrf52840/uf2", fileformat: "uf2", filename: "SlimeNRF_slimenrf_r3_Tracker"}, | |
| {boardname: "slimevrmini_p1_uf2/nrf52833", fileformat: "uf2", filename: "SlimeNRF_slimevrmini_p1_Tracker"}, | |
| {boardname: "slimevrmini_p2_uf2/nrf52833", fileformat: "uf2", filename: "SlimeNRF_slimevrmini_p2_Tracker"}, | |
| {boardname: "slimevrmini_p3r6_uf2/nrf52833", fileformat: "uf2", filename: "SlimeNRF_slimevrmini_p3_r6_Tracker"}, | |
| {boardname: "slimevrmini_p3r7_uf2/nrf52833", fileformat: "uf2", filename: "SlimeNRF_slimevrmini_p3_r7_Tracker"}, | |
| {boardname: "slimevrmini_p4_uf2/nrf52833", fileformat: "uf2", filename: "SlimeNRF_slimevrmini_p4r8_Tracker"}, | |
| {boardname: "slimevrmini_p4r9_uf2/nrf52833", fileformat: "uf2", filename: "SlimeNRF_slimevrmini_p4r9_Tracker"}, | |
| {boardname: "slimevrmini_p4r11_uf2/nrf52833", fileformat: "uf2", filename: "SlimeNRF_slimevrmini_p4r11_Tracker"}, | |
| {boardname: "nrf52dk/nrf52832", fileformat: "hex", filename: "SlimeNRF_nRF52dk_Tracker"}, | |
| {boardname: "nrf52840dk/nrf52840", fileformat: "hex", filename: "SlimeNRF_nRF52840dk_Tracker"}, | |
| ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π» Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| path: zephyr-workspace/SlimeNRF-CI | |
| submodules: recursive | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: π§° Cache + Install Apt Dependencies | |
| id: restore-apt | |
| uses: awalsh128/cache-apt-pkgs-action@latest | |
| with: | |
| packages: >- | |
| git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget | |
| python3-dev python3-pip python3-setuptools python3-tk python3-wheel python3-venv | |
| xz-utils file make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 | |
| version: 1.0 | |
| - name: π¦ Restore Zephyr SDK | |
| id: restore-sdk | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ~/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }} | |
| key: zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }} | |
| fail-on-cache-miss: true | |
| - name: πͺ Register Zephyr SDK | |
| id: register-sdk | |
| run: | | |
| ~/zephyr-sdk-${{ env.ZEPHYR_SDK_VERSION }}/setup.sh -c -t arm-zephyr-eabi | |
| - name: π¦ Restore West Workspace | |
| id: restore-west | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: | | |
| zephyr-workspace/.west | |
| zephyr-workspace/zephyr | |
| zephyr-workspace/nrf | |
| zephyr-workspace/modules | |
| zephyr-workspace/nrfxlib | |
| zephyr-workspace/bootloader | |
| zephyr-workspace/tools | |
| key: west-workspace-${{ needs.setup.outputs.sdk-hash }} | |
| fail-on-cache-miss: true | |
| - name: π¦ Restore PIP Requirements | |
| id: restore-pip | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ~/.venv | |
| key: venv-pip-${{ env.ZEPHYR_SDK_VERSION }} | |
| fail-on-cache-miss: true | |
| - name: β»οΈ Register Zephyr Workspace | |
| id: register-west | |
| run: | | |
| echo "$HOME/.venv/bin" >> $GITHUB_PATH | |
| export PATH="$HOME/.venv/bin:$PATH" | |
| cd zephyr-workspace | |
| west zephyr-export | |
| - name: π¦ Restore Repository | |
| id: restore-repository | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: zephyr-workspace/SlimeVR-Tracker-nRF | |
| key: firmware-${{ needs.setup.outputs.repo-hash }} | |
| fail-on-cache-miss: true | |
| - name: π¨ Build SlimeVR-Tracker-nRF - ${{ matrix.boards.boardname }} | |
| id: build-firmware | |
| run: | | |
| cd zephyr-workspace | |
| sed -i "/printk(FW_STRING);/a printk(\"Repo: ${{ needs.setup.outputs.repo }}@${{ needs.setup.outputs.branch }} | SDK: ${{ needs.setup.outputs.sdk-revision }}\\\\n\");" SlimeVR-Tracker-nRF/src/console.c | |
| sudo rm -rf Releases | |
| mkdir -p Releases | |
| rm -rf "SlimeVR-Tracker-nRF/build" | |
| west build \ | |
| --board ${{ matrix.boards.boardname }} \ | |
| --pristine=always "SlimeVR-Tracker-nRF" \ | |
| --build-dir "SlimeVR-Tracker-nRF/build" \ | |
| -- \ | |
| -DNCS_TOOLCHAIN_VERSION=NONE \ | |
| -DBOARD_ROOT=../"SlimeVR-Tracker-nRF" | |
| mv SlimeVR-Tracker-nRF/build/SlimeVR-Tracker-nRF/zephyr/zephyr.${{ matrix.boards.fileformat }} Releases/${{ matrix.boards.filename }}.${{ matrix.boards.fileformat }} | |
| - name: πΎ Upload Artifact - ${{ matrix.boards.boardname }} | |
| id: upload-artifact | |
| if: ${{ steps.build-firmware.outcome == 'success' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.boards.filename }} | |
| if-no-files-found: warn | |
| path: zephyr-workspace/Releases/${{ matrix.boards.filename }}.${{ matrix.boards.fileformat }} |