-
-
Notifications
You must be signed in to change notification settings - Fork 121
🚧 Add Wokwi ESP32 simulator CI workflow with Playwright web interface testing, boot validation scenarios, combined firmware image support, and network debugging #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mdev
Are you sure you want to change the base?
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the
Comment |
Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
…compatibility Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
|
@copilot why are we still getting errors for missing WOKWI_CLI_TOKEN when I have added as both environment secret and GitHub actions repository secret? |
Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>
The workflow was missing the The Wokwi CLI requires this token to authenticate. The workflow now references |
|
@copilot Error: wokwi.toml not found in /home/runner/work/WLED-MM/WLED-MM/test/wokwi/diagram.json. |
…json path Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>
Fixed in commit 685c75d. The issue was that |
|
@copilot Wokwi CLI v0.19.1 (e0043c48bf15) |
Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>
Fixed in commit ae0b312. The token was set as an environment variable in the workflow step but wasn't being passed to the child process that runs |
|
@coderabbitai do you have any insight as to why we are seeing this error in the most recent run API Error: Unauthorized |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 4050 🏁 Script executed: Length of output: 934 🏁 Script executed: Length of output: 154 @netmindz The "Unauthorized" error from Wokwi CLI indicates the authentication token isn't being properly recognized. Based on the workflow configuration, here are the likely issues: Probable Causes
Verification StepsHow to Fix
Debug OptionTo confirm the token is being passed (without exposing it), you could temporarily add this to the workflow before the wokwi-cli call: This will help confirm whether the secret is reaching the script. 🏁 Script executed: Length of output: 2769 🏁 Script executed: Length of output: 33 @netmindz Based on the analysis, here's what's happening and how to fix it: Root CauseYour workflow cannot access environment secrets because it doesn't specify an Step-by-Step Fix1. Verify Current Secret ConfigurationVisit this URL (requires repository admin access): Check:
2. Add/Update Repository Secret
3. Get a Fresh Token (if needed)If you're unsure about your token's validity:
4. Add Debug Logging to WorkflowTo help diagnose this in the future, I recommend adding this debug step to your workflow. Add it right before the "Start Wokwi simulator in background" step: - name: Debug - Verify token is set
run: |
if [ -z "$WOKWI_CLI_TOKEN" ]; then
echo "❌ ERROR: WOKWI_CLI_TOKEN is not set"
echo "Please configure WOKWI_CLI_TOKEN as a repository secret"
exit 1
else
echo "✅ WOKWI_CLI_TOKEN is set (length: ${#WOKWI_CLI_TOKEN} characters)"
fi
env:
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}This will fail fast with a clear error message if the secret isn't configured. Why This HappensGitHub Actions has two types of secrets:
Your workflow uses the default approach without an environment, so it needs a repository secret. Next StepsAfter configuring the repository secret:
Let me know if you still see the error after verifying the repository secret is properly configured! 🚀 |
|
@copilot please apply recommendation 4 |
Fixed error where debug output was being passed as filename to esptool.py: **Problem:** The find_file function echoed debug messages to stdout, which were then captured by command substitution and passed as arguments to esptool.py, causing "No such file or directory" errors with the debug text as the filename. **Root Cause:** In bash, command substitution $(command) captures ALL output from the command, not just the intended return value. The function was echoing both debug messages and the file path to stdout. **Fix:** - Redirect all debug output to stderr using >&2 - Only the actual file path goes to stdout - Command substitution now captures just the file path - Debug output is still visible to user but doesn't interfere with logic The script will now correctly pass file paths to esptool.py while still showing helpful debug information. Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
... Fixed in commit 4ad90ba. The find_file function was echoing debug messages to stdout, which were captured by command substitution and passed as filenames to esptool.py. All debug output now goes to stderr (>&2), so only the actual file path is returned to the caller. |
|
@copilot "start wokwi in background" failed with |
Fixed error where run-simulator.sh was checking for firmware.bin instead of the combined firmware image: **Problem:** After switching to combined firmware approach, run-simulator.sh still checked for "firmware.bin" which no longer exists. The prepare-firmware.sh script now creates "firmware-combined.bin" instead. **Fix:** - Updated firmware existence check in run-simulator.sh - Changed from "firmware.bin" to "firmware-combined.bin" - Error message updated to reflect the correct filename The simulator will now correctly detect the combined firmware image before starting. Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
... Fixed in commit 48252aa. The run-simulator.sh script was still checking for "firmware.bin" but the prepare-firmware.sh script now creates "firmware-combined.bin". Updated the filename check to match the combined firmware image approach. |
|
@copilot please perform a comprehensive review of this PR, and look for remaining inconsistencies. Summarize your results, but do not modify the source code yet. |
Comprehensive Review SummaryI've performed a thorough review of all Wokwi CI files. The implementation is well-structured and consistent, with only minor areas for potential improvement: ✅ Strengths
|
|
@copilot please add firmware-combined.bin to uploaded artifacts |
Added firmware-combined.bin to the test results artifacts: **Change:** - Include test/wokwi/firmware-combined.bin in artifact upload - Allows maintainers to download and inspect the combined firmware image - Useful for debugging firmware structure and verifying merge_bin output The combined firmware image contains bootloader (0x1000), partitions (0x8000), and application (0x10000) - having this artifact helps diagnose any issues with the firmware merge process. Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
|
@copilot can wokwi provide more debug information? We still cannot connect to the esp32 asyncwebserver, but it looks like the wled firmware is starting correctly now. |
To enable additional debug information from Wokwi, we can:
[wokwi]
logLevel = "debug" # Options: error, warn, info, debug, trace
[[net.forward]]
from = "localhost:8080"
to = "target:80"
logLevel = "debug" # Log all network traffic
wokwi-cli --timeout ${WOKWI_TIMEOUT}000 --verbose .
"serialMonitor": {
"display": "always",
"newline": "lf",
"bufferSize": 8192
}Would you like me to implement these debugging enhancements? The network debugging (option 2) would be most useful for diagnosing the AsyncWebServer connection issues. |
|
@copilot yes please implement options 1 (with loglevel=warn), option 2 (debug network traffic), and option 4 (increase serial buffer) |
Added debugging configuration to help diagnose AsyncWebServer connection issues: 1. **wokwi.toml** - Added log level configuration: - logLevel = "warn" for general Wokwi output - logLevel = "debug" for network traffic logging on port forwarding - This will show detailed network traffic between localhost:8080 and target:80 2. **diagram.json** - Increased serial buffer: - bufferSize: 8192 (up from default) - Prevents serial output truncation during debugging - Ensures complete capture of firmware logs These changes provide visibility into: - Network connection attempts and failures - HTTP request/response traffic - AsyncWebServer initialization and operation - Any network-related errors or timeouts Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Implemented in commit a726141. Added:
The next CI run will show detailed network traffic logs between localhost:8080 and target:80, helping diagnose the AsyncWebServer connection issues. |
Plan for Wokwi CI Integration
Implementation Summary
Complete CI workflow using Wokwi ESP32 simulator with Playwright testing, combined firmware image support (bootloader + partitions + app), enhanced file discovery, comprehensive error handling, and advanced debugging capabilities. All scripts correctly reference the combined firmware image (firmware-combined.bin), which is now included in artifact uploads for debugging purposes.
Debug Configuration
To diagnose AsyncWebServer connection issues, the implementation includes:
These debugging features provide comprehensive visibility into network connectivity, web server initialization, and potential connection failures, enabling efficient troubleshooting of the web interface testing workflow.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.