Skip to content

ci: add qemu test

ci: add qemu test #831

Workflow file for this run

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 apt dependencies
run: sudo apt update && sudo apt install -y libgcrypt20 libglib2.0-0 libpixman-1-0 libsdl2-2.0-0 libslirp0
- name: Setup Python environment
uses: ./.github/actions/setup-python-env
- 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 \
$PYTEST_COV_ARGS
- name: Upload test results
uses: ./.github/actions/upload-test-results
if: always()
with:
name: test-results-qemu
xml_file: pytest-qemu.xml
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 apt dependencies
run: apt update && apt install -y socat zip
- name: Setup Python environment
uses: ./.github/actions/setup-python-env
- 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 \
$PYTEST_COV_ARGS
- name: Upload test results
uses: ./.github/actions/upload-test-results
if: always()
with:
name: test-results-${{ matrix.python-version }}-${{ matrix.arch }}
xml_file: pytest-${{ matrix.python-version }}-${{ matrix.arch }}.xml
- 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 }}-${{ matrix.arch }}
path: logs.zip