|
| 1 | +# Copyright (c) 2020 Linaro Limited. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: Zephyr West Command Tests |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + paths: |
| 9 | + - 'scripts/west-commands.yml' |
| 10 | + - 'scripts/west_commands/**' |
| 11 | + pull_request: |
| 12 | + paths: |
| 13 | + - 'scripts/west-commands.yml' |
| 14 | + - 'scripts/west_commands/**' |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + python-version: [3.6, 3.7, 3.8] |
| 22 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 23 | + steps: |
| 24 | + - name: checkout |
| 25 | + uses: actions/checkout@v2 |
| 26 | + - name: Set up Python ${{ matrix.python-version }} |
| 27 | + uses: actions/setup-python@v1 |
| 28 | + with: |
| 29 | + python-version: ${{ matrix.python-version }} |
| 30 | + - name: cache-pip-linux |
| 31 | + if: startsWith(runner.os, 'Linux') |
| 32 | + uses: actions/cache@v1 |
| 33 | + with: |
| 34 | + path: ~/.cache/pip |
| 35 | + key: ${{ runner.os }}-pip-${{ matrix.python-version }} |
| 36 | + restore-keys: | |
| 37 | + ${{ runner.os }}-pip-${{ matrix.python-version }} |
| 38 | + - name: cache-pip-mac |
| 39 | + if: startsWith(runner.os, 'macOS') |
| 40 | + uses: actions/cache@v1 |
| 41 | + with: |
| 42 | + path: ~/Library/Caches/pip |
| 43 | + # Trailing '-' was just to get a different cache name |
| 44 | + key: ${{ runner.os }}-pip-${{ matrix.python-version }}- |
| 45 | + restore-keys: | |
| 46 | + ${{ runner.os }}-pip-${{ matrix.python-version }}- |
| 47 | + - name: cache-pip-win |
| 48 | + if: startsWith(runner.os, 'Windows') |
| 49 | + uses: actions/cache@v1 |
| 50 | + with: |
| 51 | + path: ~\AppData\Local\pip\Cache |
| 52 | + key: ${{ runner.os }}-pip-${{ matrix.python-version }} |
| 53 | + restore-keys: | |
| 54 | + ${{ runner.os }}-pip-${{ matrix.python-version }} |
| 55 | + - name: install pytest |
| 56 | + run: | |
| 57 | + pip3 install pytest west |
| 58 | + - name: run pytest-win |
| 59 | + if: runner.os == 'Windows' |
| 60 | + run: | |
| 61 | + cmd /C "set PYTHONPATH=.\scripts\west_commands && pytest ./scripts/west_commands/tests/" |
| 62 | + - name: run pytest-mac-linux |
| 63 | + if: runner.os != 'Windows' |
| 64 | + run: | |
| 65 | + PYTHONPATH=./scripts/west_commands pytest ./scripts/west_commands/tests/ |
0 commit comments