()
| 40 | |
| 41 | |
| 42 | def main() -> int: |
| 43 | args, unknown_args = parse_args() |
| 44 | |
| 45 | # Extract example name from sketch_dir (e.g., "examples/Blink" -> "Blink") |
| 46 | example_name = args.sketch_dir.split("/")[-1] |
| 47 | |
| 48 | # Check if sketch is filtered out for WASM platform |
| 49 | try: |
| 50 | from ci.boards import WEBTARGET |
| 51 | from ci.compiler.board_example_utils import should_skip_example_for_board |
| 52 | |
| 53 | should_skip, reason = should_skip_example_for_board(WEBTARGET, example_name) |
| 54 | if should_skip: |
| 55 | print(f"\nWARNING: Example '{example_name}' is filtered for WASM platform") |
| 56 | print(f"Reason: {reason}\n") |
| 57 | except FileNotFoundError: |
| 58 | pass |
| 59 | except ValueError as e: |
| 60 | print(f"\nWARNING: Error checking filters for '{example_name}': {e}") |
| 61 | except KeyboardInterrupt as ki: |
| 62 | from ci.util.global_interrupt_handler import handle_keyboard_interrupt |
| 63 | |
| 64 | handle_keyboard_interrupt(ki) |
| 65 | raise |
| 66 | except Exception as e: |
| 67 | print(f"Note: Could not verify filter compatibility ({type(e).__name__})") |
| 68 | |
| 69 | # Print what we're going to do |
| 70 | if args.run: |
| 71 | _print_panel( |
| 72 | "FastLED WASM Build Pipeline", |
| 73 | [ |
| 74 | f"Will:", |
| 75 | f" 1. Compile {example_name} to WASM", |
| 76 | f" 2. Launch headless browser demo", |
| 77 | f" 3. Run for 5 seconds, verify rendering", |
| 78 | f" 4. Exit automatically", |
| 79 | ], |
| 80 | ) |
| 81 | else: |
| 82 | _print_panel( |
| 83 | "FastLED WASM Build Pipeline", |
| 84 | [ |
| 85 | f"Will:", |
| 86 | f" * Compile {example_name} to WASM", |
| 87 | f" (Use --run to add automated testing)", |
| 88 | ], |
| 89 | ) |
| 90 | |
| 91 | steps = "2" if args.run else "1" |
| 92 | print(f"Step 1/{steps}: Compiling WASM...") |
| 93 | |
| 94 | # Output to examples/<name>/fastled_js/fastled.js to match expected location |
| 95 | from pathlib import Path |
| 96 | |
| 97 | output_dir = Path("examples") / example_name / "fastled_js" |
| 98 | output_dir.mkdir(parents=True, exist_ok=True) |
| 99 |
no test coverage detected