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    - v2.7-branch
10    paths:
11    - 'scripts/west-commands.yml'
12    - 'scripts/west_commands/**'
13    - '.github/workflows/west_cmds.yml'
14  pull_request:
15    branches:
16    - v2.7-branch
17    paths:
18    - 'scripts/west-commands.yml'
19    - 'scripts/west_commands/**'
20    - '.github/workflows/west_cmds.yml'
21
22jobs:
23  west-commnads:
24    name: West Command Tests
25    runs-on: ${{ matrix.os }}
26    strategy:
27      matrix:
28        python-version: [3.6, 3.7, 3.8]
29        os: [ubuntu-20.04, macos-11, windows-2022]
30        exclude:
31          - os: macos-11
32            python-version: 3.6
33          - os: windows-2022
34            python-version: 3.6
35    steps:
36    - name: checkout
37      uses: actions/checkout@v3
38    - name: Set up Python ${{ matrix.python-version }}
39      uses: actions/setup-python@v4
40      with:
41        python-version: ${{ matrix.python-version }}
42    - name: cache-pip-linux
43      if: startsWith(runner.os, 'Linux')
44      uses: actions/cache@v3
45      with:
46        path: ~/.cache/pip
47        key: ${{ runner.os }}-pip-${{ matrix.python-version }}
48        restore-keys: |
49          ${{ runner.os }}-pip-${{ matrix.python-version }}
50    - name: cache-pip-mac
51      if: startsWith(runner.os, 'macOS')
52      uses: actions/cache@v3
53      with:
54        path: ~/Library/Caches/pip
55        # Trailing '-' was just to get a different cache name
56        key: ${{ runner.os }}-pip-${{ matrix.python-version }}-
57        restore-keys: |
58          ${{ runner.os }}-pip-${{ matrix.python-version }}-
59    - name: cache-pip-win
60      if: startsWith(runner.os, 'Windows')
61      uses: actions/cache@v3
62      with:
63        path: ~\AppData\Local\pip\Cache
64        key: ${{ runner.os }}-pip-${{ matrix.python-version }}
65        restore-keys: |
66          ${{ runner.os }}-pip-${{ matrix.python-version }}
67    - name: install pytest
68      run: |
69        pip3 install wheel
70        pip3 install pytest west pyelftools canopen progress mypy intelhex psutil
71    - name: run pytest-win
72      if: runner.os == 'Windows'
73      run: |
74        python ./scripts/west_commands/run_tests.py
75    - name: run pytest-mac-linux
76      if: runner.os != 'Windows'
77      run: |
78        ./scripts/west_commands/run_tests.py
79