1# Copyright (c) 2020 Linaro Limited. 2# SPDX-License-Identifier: Apache-2.0 3 4name: Zephyr West Command Tests 5 6on: 7 push: 8 branches: 9 - main 10 - v*-branch 11 - collab-* 12 paths: 13 - 'scripts/west-commands.yml' 14 - 'scripts/west_commands/**' 15 - '.github/workflows/west_cmds.yml' 16 pull_request: 17 branches: 18 - main 19 - v*-branch 20 - collab-* 21 paths: 22 - 'scripts/west-commands.yml' 23 - 'scripts/west_commands/**' 24 - '.github/workflows/west_cmds.yml' 25 26jobs: 27 west-commnads: 28 name: West Command Tests 29 runs-on: ${{ matrix.os }} 30 strategy: 31 matrix: 32 python-version: ['3.10', '3.11', '3.12', '3.13'] 33 os: [ubuntu-22.04, macos-14, windows-2022] 34 steps: 35 - name: checkout 36 uses: actions/checkout@v4 37 - name: Set up Python ${{ matrix.python-version }} 38 uses: actions/setup-python@v5 39 with: 40 python-version: ${{ matrix.python-version }} 41 - name: cache-pip-linux 42 if: startsWith(runner.os, 'Linux') 43 uses: actions/cache@v4 44 with: 45 path: ~/.cache/pip 46 key: ${{ runner.os }}-pip-${{ matrix.python-version }} 47 restore-keys: | 48 ${{ runner.os }}-pip-${{ matrix.python-version }} 49 - name: cache-pip-mac 50 if: startsWith(runner.os, 'macOS') 51 uses: actions/cache@v4 52 with: 53 path: ~/Library/Caches/pip 54 # Trailing '-' was just to get a different cache name 55 key: ${{ runner.os }}-pip-${{ matrix.python-version }}- 56 restore-keys: | 57 ${{ runner.os }}-pip-${{ matrix.python-version }}- 58 - name: cache-pip-win 59 if: startsWith(runner.os, 'Windows') 60 uses: actions/cache@v4 61 with: 62 path: ~\AppData\Local\pip\Cache 63 key: ${{ runner.os }}-pip-${{ matrix.python-version }} 64 restore-keys: | 65 ${{ runner.os }}-pip-${{ matrix.python-version }} 66 - name: install pytest 67 run: | 68 pip install pytest west pyelftools canopen natsort progress mypy intelhex psutil ply pyserial anytree 69 - name: run pytest-win 70 if: runner.os == 'Windows' 71 run: | 72 python ./scripts/west_commands/run_tests.py 73 - name: run pytest-mac-linux 74 if: runner.os != 'Windows' 75 run: | 76 ./scripts/west_commands/run_tests.py 77