File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 2121 - run : hatch run ruff format --check .
2222 - run : hatch run ruff check .
2323 - run : hatch run mypy .
24+ - name : Run a Wokwi CI server
25+ uses : wokwi/wokwi-ci-server-action@v1
2426 - run : hatch run dev:pytest
27+ env :
28+ WOKWI_CLI_TOKEN : ${{ secrets.WOKWI_CLI_TOKEN }}
Original file line number Diff line number Diff line change 1515 "hello_world.bin" : f"{ HELLO_WORLD_URL } /hello_world.bin" ,
1616 "hello_world.elf" : f"{ HELLO_WORLD_URL } /hello_world.elf" ,
1717}
18+ SLEEP_TIME = int (os .getenv ("WOKWI_SLEEP_TIME" , "10" ))
1819
1920
2021async def main () -> None :
@@ -50,10 +51,10 @@ async def main() -> None:
5051 elf = "hello_world.elf" ,
5152 )
5253
53- # Stream serial output for 10 seconds
54+ # Stream serial output for a few seconds
5455 serial_task = asyncio .create_task (client .serial_monitor_cat ())
55- print ("Simulation started, waiting for 10 seconds…" )
56- await asyncio .sleep (10 )
56+ print (f "Simulation started, waiting for { SLEEP_TIME } seconds…" )
57+ await asyncio .sleep (SLEEP_TIME )
5758 serial_task .cancel ()
5859
5960 # Disconnect from the simulator
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2025-present CodeMagic LTD
2+ #
3+ # SPDX-License-Identifier: MIT
4+
5+ import os
6+ import subprocess
7+ import sys
8+
9+
10+ def test_hello_esp32_example () -> None :
11+ """`python -m examples.hello_esp32.main` runs the hello_esp32 example and exits with 0."""
12+
13+ assert os .environ .get ("WOKWI_CLI_TOKEN" ) is not None , (
14+ "WOKWI_CLI_TOKEN environment variable is not set. You can get it from https://wokwi.com/dashboard/ci."
15+ )
16+
17+ result = subprocess .run (
18+ [sys .executable , "-m" , "examples.hello_esp32.main" ],
19+ check = False ,
20+ capture_output = True ,
21+ text = True ,
22+ env = {** os .environ , "WOKWI_SLEEP_TIME" : "1" },
23+ )
24+
25+ assert result .returncode == 0
26+ assert "main_task: Calling app_main()" in result .stdout
You can’t perform that action at this time.
0 commit comments