Skip to content

Feat/support filter by sdkconfig #23

Feat/support filter by sdkconfig

Feat/support filter by sdkconfig #23

Workflow file for this run

name: Python Tests with Coverage
on:
push:
branches: [main]
paths:
- "**.py"
pull_request:
branches: [main]
paths:
- "**.py"
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
# `contents` is for permission to the contents of the repository.
# `pull-requests` is for permission to pull request
permissions:
contents: write
checks: write
pull-requests: write
jobs:
test-python:
strategy:
matrix:
include:
- os: windows-latest
python-version: "3.8"
- os: ubuntu-latest
python-version: "3.13"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e '.[test]'
- name: Fake IDF
run: |
mkdir /tmp/esp-idf
pushd /tmp/esp-idf
mkdir -p tools/idf_py_actions
echo "SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6', 'esp32h2', 'esp32p4']" >> tools/idf_py_actions/constants.py
echo "PREVIEW_TARGETS = ['linux', 'esp32c5', 'esp32c61', 'esp32h21']" >> tools/idf_py_actions/constants.py
popd
- name: Run tests with pytest and coverage (windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
set IDF_PATH=/tmp/esp-idf
pytest --junitxml pytest.xml tests/
- name: Run tests with pytest and coverage (linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
export IDF_PATH=/tmp/esp-idf
pytest --junitxml pytest.xml --cov-report term-missing --cov idf_ci tests/ | tee pytest-coverage.txt
- name: Upload coverage report to PR (Python 3.13 only)
if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' }}
uses: MishaKav/pytest-coverage-comment@v1
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml