| # Copyright (c) 2025 Project CHIP Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| name: Mypy Type Validation |
| |
| on: |
| push: |
| branches: [ master ] |
| paths: |
| - 'src/python_testing/matter_testing_infrastructure/**/*.py' |
| pull_request: |
| paths: |
| - 'src/python_testing/matter_testing_infrastructure/**/*.py' |
| |
| jobs: |
| mypy-check: |
| runs-on: ubuntu-latest |
| if: github.actor != 'restyled-io[bot]' |
| |
| container: |
| image: ghcr.io/project-chip/chip-build:119 |
| options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" |
| |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v4 |
| |
| - name: Checkout submodules & Bootstrap |
| uses: ./.github/actions/checkout-submodules-and-bootstrap |
| with: |
| platform: linux |
| |
| - name: Build Python environment |
| run: | |
| scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv' |
| |
| - name: Run mypy validation |
| run: | |
| # List the directory to debug the file structure |
| ls -la src/python_testing/matter_testing_infrastructure/chip/testing/ |
| |
| # TODO: Expand this list to include more files once they are mypy-compatible |
| # Eventually we should just check all files in the chip/testing directory |
| |
| ./scripts/run_in_python_env.sh out/venv "mypy --config-file=src/python_testing/matter_testing_infrastructure/mypy.ini \ |
| src/python_testing/matter_testing_infrastructure/chip/testing/apps.py \ |
| src/python_testing/matter_testing_infrastructure/chip/testing/tasks.py \ |
| src/python_testing/matter_testing_infrastructure/chip/testing/taglist_and_topology_test.py \ |
| src/python_testing/matter_testing_infrastructure/chip/testing/pics.py" |
| |
| # Print a reminder about expanding coverage |
| echo "⚠️ NOTE: Currently only checking a subset of files. Remember to expand coverage!" |