# Copyright (c) 2021-2022 Chris Reed # Copyright (c) 2025 Antonio Chiu # Copyright (c) 2026 Arm Limited # pyocd workflow for: # - checking code with flake8 # - running unit tests # - run test/import_all.py script # - build source distro and wheel, check with twine name: basic test # Don't run for changes that only affect the docs directory. on: push: paths-ignore: - 'docs/**' pull_request: paths-ignore: - 'docs/**' jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: os: - ubuntu-latest - macos-latest - windows-latest python-version: - "3.9" - "3.10" - "3.11" - "3.12" - "3.13" - "3.14" steps: # Only check out HEAD. We don't need the full history. - uses: actions/checkout@v6 with: fetch-depth: 1 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} # This requires pip 20.1+. As of 28 Feb 2021 this condition is met for all supported # Python versions on all OSes. - name: Get pip cache dir id: pip-cache shell: bash run: | echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - name: Setup pip cache uses: actions/cache@v5 with: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg') }} restore-keys: | ${{ runner.os }}-pip- - name: Install dependencies run: | python -m pip install --upgrade setuptools pip wheel build twine pip install -e .[test] # Stop the build if there are Python syntax errors or undefined names. - name: Lint with flake8 run: | flake8 pyocd test --count --select=E9,F63,F7,F82 --show-source --statistics - name: Test with pytest run: | pytest --junitxml=test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov=pyocd - name: Test importing all modules run: | python test/import_all.py - name: Test build run: | python -mbuild - name: Check packages run: | twine check dist/* - name: Upload pytest test results uses: actions/upload-artifact@v6 with: name: pytest-results-${{ matrix.python-version }}-${{ matrix.os }} path: | test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml .coverage* # Use always() to always run this step to publish test results when there are test failures if: ${{ always() }}