ci: build the board, run twister, and a scoped compliance pass #35
Workflow file for this run
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
| name: CI | |
| # Build the firmware for every overlay, run the native_sim unit tests, and run a | |
| # scoped Zephyr compliance pass (issue #17). The board, drivers and dts-bindings | |
| # live out-of-tree in this repo and are built against a pinned upstream Zephyr | |
| # via BOARD_ROOT + ZEPHYR_EXTRA_MODULES, mirroring scripts/build_m5sticks3.sh. | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # Pinned upstream Zephyr. The container below bundles the Zephyr SDK that this | |
| # revision wants (zephyr/SDK_VERSION = 1.0.1); bump them together. | |
| ZEPHYR_REV: v4.4.0 | |
| # ghcr.io/zephyrproject-rtos/ci image whose bundled SDK is 1.0.1. | |
| CI_IMAGE: ghcr.io/zephyrproject-rtos/ci:v0.29.1 | |
| jobs: | |
| repo-integrity: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Repository integrity checks | |
| run: bash verify.sh | |
| build: | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/zephyrproject-rtos/ci:v0.29.1 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { name: default, overlay: "", blob: false } | |
| - { name: audio, overlay: "overlay-audio.conf", blob: false } | |
| - { name: ir, overlay: "overlay-ir.conf", blob: false } | |
| - { name: ble, overlay: "overlay-ble.conf", blob: true } | |
| - { name: wifi, overlay: "overlay-wifi.conf", blob: true } | |
| - { name: demo, overlay: "overlay-ble.conf;overlay-audio.conf;overlay-ir.conf", blob: true } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: repo | |
| - name: Cache Zephyr workspace | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ws/.west | |
| ws/zephyr | |
| ws/modules | |
| ws/bootloader | |
| ws/tools | |
| key: zephyr-ws-${{ env.ZEPHYR_REV }} | |
| - name: Set up Zephyr workspace | |
| run: | | |
| if [ ! -d ws/.west ]; then | |
| west init -m https://github.com/zephyrproject-rtos/zephyr --mr "$ZEPHYR_REV" ws | |
| fi | |
| cd ws && west update --narrow -o=--depth=1 && west zephyr-export | |
| - name: Fetch Espressif HAL blobs | |
| if: ${{ matrix.blob }} | |
| run: cd ws && west blobs fetch hal_espressif | |
| - name: Build (${{ matrix.name }}) | |
| working-directory: ws | |
| env: | |
| BOARD_ROOT: ${{ github.workspace }}/repo | |
| ZEPHYR_EXTRA_MODULES: ${{ github.workspace }}/repo | |
| run: | | |
| args=(-p always -b m5stack_sticks3/esp32s3/procpu "$GITHUB_WORKSPACE/repo/app") | |
| if [ -n "${{ matrix.overlay }}" ]; then | |
| args+=(-- -DEXTRA_CONF_FILE="${{ matrix.overlay }}") | |
| fi | |
| west build "${args[@]}" | |
| twister: | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/zephyrproject-rtos/ci:v0.29.1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: repo | |
| - name: Cache Zephyr workspace | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ws/.west | |
| ws/zephyr | |
| ws/modules | |
| ws/bootloader | |
| ws/tools | |
| key: zephyr-ws-${{ env.ZEPHYR_REV }} | |
| - name: Set up Zephyr workspace | |
| run: | | |
| if [ ! -d ws/.west ]; then | |
| west init -m https://github.com/zephyrproject-rtos/zephyr --mr "$ZEPHYR_REV" ws | |
| fi | |
| cd ws && west update --narrow -o=--depth=1 && west zephyr-export | |
| - name: Twister (native_sim) | |
| working-directory: ws | |
| env: | |
| ZEPHYR_EXTRA_MODULES: ${{ github.workspace }}/repo | |
| run: west twister -p native_sim --inline-logs -v -T "$GITHUB_WORKSPACE/repo/tests" | |
| - name: Upload twister output on failure | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: twister-out | |
| path: ws/twister-out/**/*.log | |
| if-no-files-found: ignore | |
| compliance: | |
| # PRs only: the checks run over the PR's own commits (base..head). On a push | |
| # to main the range is the squash-merge commit, which carries no body and no | |
| # Signed-off-by, so Gitlint/Identity would false-fail there. | |
| if: ${{ github.event_name == 'pull_request' }} | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/zephyrproject-rtos/ci:v0.29.1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: repo | |
| fetch-depth: 0 | |
| - name: Cache Zephyr workspace | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ws/.west | |
| ws/zephyr | |
| ws/modules | |
| ws/bootloader | |
| ws/tools | |
| key: zephyr-ws-${{ env.ZEPHYR_REV }} | |
| - name: Set up Zephyr workspace | |
| run: | | |
| if [ ! -d ws/.west ]; then | |
| west init -m https://github.com/zephyrproject-rtos/zephyr --mr "$ZEPHYR_REV" ws | |
| fi | |
| cd ws && west update --narrow -o=--depth=1 && west zephyr-export | |
| - name: Compliance (subset that fits an out-of-tree module repo) | |
| working-directory: repo | |
| env: | |
| ZEPHYR_BASE: ${{ github.workspace }}/ws/zephyr | |
| run: | | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE/repo" | |
| # Run only the checks that are meaningful for this repo's layout. These | |
| # are deliberately NOT run because they false-fail on an out-of-tree | |
| # module/showcase repo, not on a real defect: | |
| # Kconfig / SysbuildKconfig - our own CONFIG_* live in this module, | |
| # which the compliance Kconfig pass does not load, so it reports | |
| # them as undefined references. | |
| # LicenseAndCopyrightCheck / BinaryFiles - flag the evidence/ media | |
| # and serial logs (records kept on purpose), not source. | |
| # ClangFormat - the tree follows checkpatch, not clang-format. | |
| python3 "$ZEPHYR_BASE/scripts/ci/check_compliance.py" \ | |
| -c "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}" \ | |
| -m Checkpatch -m Gitlint -m Identity -m DevicetreeBindings -m Nits |