ci: add qemu test #830
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Target Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - "**.py" | |
| - "*/pyproject.toml" | |
| - .github/workflows/test-python.yml | |
| - "!docs/**" | |
| push: | |
| branches: [main] | |
| # cancel jobs if new commit pushed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }} | |
| jobs: | |
| test-qemu: | |
| timeout-minutes: 40 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update && sudo apt install -y libgcrypt20 libglib2.0-0 libpixman-1-0 libsdl2-2.0-0 libslirp0 | |
| pip install -U pip | |
| export PIP_EXTRA_INDEX_URL="https://dl.espressif.com/pypi" | |
| pip install cryptography --prefer-binary | |
| pip install -r requirements.txt | |
| bash foreach.sh install | |
| - name: Download and install QEMU | |
| run: | | |
| wget https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-xtensa-softmmu-esp_develop_9.2.2_20250817-x86_64-linux-gnu.tar.xz | |
| wget https://github.com/espressif/qemu/releases/download/esp-develop-9.2.2-20250817/qemu-riscv32-softmmu-esp_develop_9.2.2_20250817-x86_64-linux-gnu.tar.xz | |
| tar -xf qemu-xtensa-softmmu-esp_develop_9.2.2_20250817-x86_64-linux-gnu.tar.xz | |
| tar -xf qemu-riscv32-softmmu-esp_develop_9.2.2_20250817-x86_64-linux-gnu.tar.xz | |
| echo "$PWD/qemu/bin" >> $GITHUB_PATH | |
| - name: Run QEMU tests | |
| env: | |
| COVERAGE_FILE: ".coverage.qemu" | |
| run: | | |
| pytest pytest-embedded-qemu/tests/test_qemu.py \ | |
| --junitxml pytest-qemu.xml \ | |
| --cov-report=term-missing \ | |
| --cov=pytest_embedded \ | |
| --cov=pytest_embedded_arduino \ | |
| --cov=pytest_embedded_idf \ | |
| --cov=pytest_embedded_jtag \ | |
| --cov=pytest_embedded_qemu \ | |
| --cov=pytest_embedded_serial \ | |
| --cov=pytest_embedded_serial_esp \ | |
| --cov=pytest_embedded_wokwi \ | |
| --cov=pytest_embedded_nuttx \ | |
| - name: Save PR number | |
| if: github.event_name == 'pull_request' | |
| run: echo ${{ github.event.pull_request.number }} > pr_number.txt | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v6 | |
| if: always() | |
| with: | |
| name: test-results-qemu | |
| path: | | |
| pr_number.txt | |
| .coverage.* | |
| pytest-qemu.xml | |
| retention-days: 7 | |
| test-python: | |
| timeout-minutes: 40 | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: "3.10" | |
| arch: "ARM64" | |
| - python-version: "3.14" | |
| arch: "X64" | |
| fail-fast: false | |
| runs-on: | |
| - self-hosted | |
| - multiboard | |
| - ${{ matrix.arch }} | |
| container: | |
| image: python:${{ matrix.python-version }} | |
| options: --privileged | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install dependencies | |
| run: | | |
| apt update && apt install -y socat zip | |
| pip install -U pip | |
| export PIP_EXTRA_INDEX_URL="https://dl.espressif.com/pypi" | |
| pip install cryptography --prefer-binary | |
| pip install -r requirements.txt | |
| bash foreach.sh install | |
| - name: Check ports | |
| run: ls -la /dev/ttyUSB* | |
| - name: Run Tests with coverage | |
| env: | |
| COVERAGE_FILE: ".coverage.${{ matrix.python-version }}-${{ matrix.arch }}" | |
| run: | | |
| pytest \ | |
| --junitxml=pytest-${{ matrix.python-version }}-${{ matrix.arch }}.xml \ | |
| --cov-report=term-missing \ | |
| --cov=pytest_embedded \ | |
| --cov=pytest_embedded_arduino \ | |
| --cov=pytest_embedded_idf \ | |
| --cov=pytest_embedded_jtag \ | |
| --cov=pytest_embedded_qemu \ | |
| --cov=pytest_embedded_serial \ | |
| --cov=pytest_embedded_serial_esp \ | |
| --cov=pytest_embedded_wokwi \ | |
| --cov=pytest_embedded_nuttx | |
| - name: Save PR number | |
| if: github.event_name == 'pull_request' | |
| run: echo ${{ github.event.pull_request.number }} > pr_number.txt | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v6 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.python-version }}-${{ matrix.arch }} | |
| path: | | |
| pr_number.txt | |
| .coverage.* | |
| pytest-${{ matrix.python-version }}-${{ matrix.arch }}.xml | |
| retention-days: 7 | |
| - name: Zip log files | |
| if: failure() | |
| run: | | |
| zip -r logs.zip /tmp/pytest-embedded | |
| - uses: actions/upload-artifact@v6 | |
| if: failure() | |
| with: | |
| name: logs-${{ matrix.python-version }} | |
| path: logs.zip |