1# Copyright (c) 2020 Intel Corporation. 2# SPDX-License-Identifier: Apache-2.0 3 4name: Twister TestSuite 5 6on: 7 push: 8 branches: 9 - main 10 - v*-branch 11 - collab-* 12 paths: 13 - 'scripts/pylib/**' 14 - 'scripts/twister' 15 - 'scripts/tests/twister/**' 16 - '.github/workflows/twister_tests.yml' 17 - 'scripts/schemas/twister/' 18 pull_request: 19 branches: 20 - main 21 - v*-branch 22 paths: 23 - 'scripts/pylib/**' 24 - 'scripts/twister' 25 - 'scripts/tests/twister/**' 26 - '.github/workflows/twister_tests.yml' 27 - 'scripts/schemas/twister/' 28 29jobs: 30 twister-tests: 31 name: Twister Unit Tests 32 runs-on: ${{ matrix.os }} 33 strategy: 34 matrix: 35 python-version: ['3.10', '3.11', '3.12', '3.13'] 36 os: [ubuntu-22.04] 37 steps: 38 - name: checkout 39 uses: actions/checkout@v4 40 - name: Set up Python ${{ matrix.python-version }} 41 uses: actions/setup-python@v5 42 with: 43 python-version: ${{ matrix.python-version }} 44 - name: cache-pip-linux 45 if: startsWith(runner.os, 'Linux') 46 uses: actions/cache@v4 47 with: 48 path: ~/.cache/pip 49 key: ${{ runner.os }}-pip-${{ matrix.python-version }} 50 restore-keys: | 51 ${{ runner.os }}-pip-${{ matrix.python-version }} 52 - name: install-packages 53 run: | 54 pip install -r scripts/requirements-base.txt -r scripts/requirements-build-test.txt -r scripts/requirements-run-test.txt 55 - name: Run pytest for twisterlib 56 env: 57 ZEPHYR_BASE: ./ 58 ZEPHYR_TOOLCHAIN_VARIANT: zephyr 59 run: | 60 echo "Run twister tests" 61 PYTHONPATH=./scripts/tests pytest ./scripts/tests/twister 62 - name: Run pytest for pytest-twister-harness 63 env: 64 ZEPHYR_BASE: ./ 65 ZEPHYR_TOOLCHAIN_VARIANT: zephyr 66 PYTHONPATH: ./scripts/pylib/pytest-twister-harness/src:${PYTHONPATH} 67 run: | 68 echo "Run twister tests" 69 pytest ./scripts/pylib/pytest-twister-harness/tests 70