1# Copyright (c) 2020 Linaro Limited.
2# Copyright (c) 2020 Nordic Semiconductor ASA
3# SPDX-License-Identifier: Apache-2.0
4
5name: Devicetree script tests
6
7on:
8  push:
9    branches:
10    - main
11    - v*-branch
12    paths:
13    - 'scripts/dts/**'
14    - '.github/workflows/devicetree_checks.yml'
15  pull_request:
16    branches:
17    - main
18    - v*-branch
19    paths:
20    - 'scripts/dts/**'
21    - '.github/workflows/devicetree_checks.yml'
22
23jobs:
24  devicetree-checks:
25    name: Devicetree script tests
26    runs-on: ${{ matrix.os }}
27    strategy:
28      matrix:
29        python-version: ['3.10', '3.11', '3.12', '3.13']
30        os: [ubuntu-22.04, macos-14, windows-2022]
31    steps:
32    - name: checkout
33      uses: actions/checkout@v4
34    - name: Set up Python ${{ matrix.python-version }}
35      uses: actions/setup-python@v5
36      with:
37        python-version: ${{ matrix.python-version }}
38    - name: cache-pip-linux
39      if: startsWith(runner.os, 'Linux')
40      uses: actions/cache@v4
41      with:
42        path: ~/.cache/pip
43        key: ${{ runner.os }}-pip-${{ matrix.python-version }}
44        restore-keys: |
45          ${{ runner.os }}-pip-${{ matrix.python-version }}
46    - name: cache-pip-mac
47      if: startsWith(runner.os, 'macOS')
48      uses: actions/cache@v4
49      with:
50        path: ~/Library/Caches/pip
51        # Trailing '-' was just to get a different cache name
52        key: ${{ runner.os }}-pip-${{ matrix.python-version }}-
53        restore-keys: |
54          ${{ runner.os }}-pip-${{ matrix.python-version }}-
55    - name: cache-pip-win
56      if: startsWith(runner.os, 'Windows')
57      uses: actions/cache@v4
58      with:
59        path: ~\AppData\Local\pip\Cache
60        key: ${{ runner.os }}-pip-${{ matrix.python-version }}
61        restore-keys: |
62          ${{ runner.os }}-pip-${{ matrix.python-version }}
63    - name: install python dependencies
64      run: |
65        pip install pytest pyyaml tox
66    - name: run tox
67      working-directory: scripts/dts/python-devicetree
68      run: |
69        tox
70