From fef317c84fd9c12824fc2d4bc31a726a690a5e76 Mon Sep 17 00:00:00 2001 From: James Maes Date: Fri, 15 Aug 2025 18:14:40 -0500 Subject: [PATCH 1/4] docs: add comprehensive release management guide --- RELEASE.md | 270 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..9807368 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,270 @@ +# ๐Ÿš€ Luke's Rocket Launcher - Release Management Guide + +## ๐Ÿ“‹ Quick Reference + +### **Branch Types & Naming** +- `main` - Production-ready code, always deployable +- `develop` - Integration branch for features +- `feature/*` - New features (from `develop`) +- `bugfix/*` - Bug fixes (from `main`) +- `release/*` - Release preparation (from `develop`) +- `hotfix/*` - Urgent fixes (from `main`) + +### **Release Commands** +```bash +# Start a new release +./scripts/release.sh 0.1.0 start + +# Finish a release (creates tag, merges to main/develop) +./scripts/release.sh 0.1.0 finish + +# Create a new branch +./scripts/create-branch.sh feature new-feature-name +``` + +--- + +## ๐ŸŒฟ Git Branching Model + +### **Main Branches** +- **`main`** - Always contains production-ready code +- **`develop`** - Integration branch for upcoming releases + +### **Supporting Branches** +- **`feature/*`** - New features (branch from `develop`, merge back to `develop`) +- **`bugfix/*`** - Bug fixes (branch from `main`, merge back to `main`) +- **`release/*`** - Release preparation (branch from `develop`, merge to both `main` and `develop`) +- **`hotfix/*`** - Critical fixes (branch from `main`, merge to both `main` and `develop`) + +--- + +## ๐Ÿš€ Release Process + +### **1. Start a Release** +```bash +# Create release branch from develop +./scripts/release.sh 0.1.0 start + +# This will: +# - Switch to develop branch +# - Create release/0.1.0 branch +# - Push to remote +``` + +### **2. Prepare the Release** +- Update version numbers in code +- Update CHANGELOG.md +- Update documentation +- Test thoroughly + +### **3. Finish the Release** +```bash +# Complete the release process +./scripts/release.sh 0.1.0 finish + +# This will: +# - Merge release branch to main +# - Create and push tag v0.1.0 +# - Merge release branch to develop +# - Clean up release branch +# - Trigger automated workflow +``` + +--- + +## โšก Automated Pipeline + +### **What Happens Automatically** +1. **Tag Push** triggers GitHub Actions workflow +2. **Workflow Builds** firmware (hardware + simulation) +3. **Workflow Creates** GitHub release +4. **Workflow Uploads** assets to release +5. **Workflow Publishes** to GitHub Packages + +### **No Manual Steps Needed** +- โŒ Don't manually create GitHub releases +- โŒ Don't manually upload assets +- โœ… Just run the release script +- โœ… Let the workflow handle everything else + +--- + +## ๐Ÿ”ง Branch Management + +### **Create New Branches** +```bash +# Feature branch (from develop) +./scripts/create-branch.sh feature new-feature-name + +# Bugfix branch (from main) +./scripts/create-branch.sh bugfix bug-description + +# Hotfix branch (from main) +./scripts/create-branch.sh hotfix urgent-fix-description +``` + +### **Branch Protection Rules** +- **`main`** - Requires PR, no direct pushes +- **`develop`** - Requires PR, no direct pushes +- **Feature branches** - Can be pushed directly + +--- + +## ๐Ÿ“ Pull Request Workflow + +### **1. Create PR** +```bash +# From feature branch to develop +gh pr create --base develop --head feature/new-feature + +# From develop to main (for releases) +gh pr create --base main --head develop +``` + +### **2. Review & Merge** +- Self-review is allowed (you're the only person) +- Merge when ready +- Delete feature branch after merge + +--- + +## ๐Ÿท๏ธ Version Management + +### **Semantic Versioning** +- **Major.Minor.Patch** (e.g., 1.2.3) +- **Major** - Breaking changes +- **Minor** - New features, backward compatible +- **Patch** - Bug fixes, backward compatible + +### **Pre-releases** +- Use for development/testing versions +- Example: 0.1.0 (pre-release) +- Mark as pre-release in GitHub + +--- + +## ๐Ÿšจ Troubleshooting + +### **Common Issues** + +#### **"already_exists" Error** +- **Cause**: Manual GitHub release conflicts with workflow +- **Solution**: Don't manually create releases, let workflow handle it + +#### **Workflow Not Running** +- **Cause**: Branch protection rules +- **Solution**: Create PR and merge to main/develop + +#### **Asset Upload Failures** +- **Cause**: Missing upload_url +- **Solution**: Ensure workflow creates release (don't skip creation) + +### **Reset Release** +```bash +# Delete local tag +git tag -d v0.1.0 + +# Delete remote tag +git push origin --delete v0.1.0 + +# Delete GitHub release manually on GitHub +# Start over with release script +``` + +--- + +## ๐Ÿ“š File Structure + +``` +Lukes-Rocket-Launcher/ +โ”œโ”€โ”€ .github/ +โ”‚ โ”œโ”€โ”€ workflows/c-cpp.yml # Main CI/CD workflow +โ”‚ โ”œโ”€โ”€ CODEOWNERS # Code ownership rules +โ”‚ โ””โ”€โ”€ pull_request_template.md # PR template +โ”œโ”€โ”€ scripts/ +โ”‚ โ”œโ”€โ”€ release.sh # Release management +โ”‚ โ”œโ”€โ”€ create-branch.sh # Branch creation +โ”‚ โ””โ”€โ”€ setup-branch-protection.sh # Branch protection setup +โ”œโ”€โ”€ code/RocketLauncher/ # Main firmware code +โ””โ”€โ”€ RELEASE.md # This file +``` + +--- + +## ๐ŸŽฏ Best Practices + +### **Do's** +- โœ… Use semantic versioning +- โœ… Test before releasing +- โœ… Update documentation +- โœ… Let automation handle releases +- โœ… Use descriptive branch names + +### **Don'ts** +- โŒ Don't manually create GitHub releases +- โŒ Don't push directly to main/develop +- โŒ Don't skip testing +- โŒ Don't forget to update version numbers + +--- + +## ๐Ÿ”„ Daily Workflow + +### **Normal Development** +1. Create feature branch: `./scripts/create-branch.sh feature new-feature` +2. Make changes and commit +3. Push and create PR to develop +4. Merge when ready + +### **Release Day** +1. Start release: `./scripts/release.sh 1.0.0 start` +2. Prepare release (version, docs, testing) +3. Finish release: `./scripts/release.sh 1.0.0 finish` +4. Wait for automation to complete +5. Deploy and announce + +--- + +## ๐Ÿ“ž Quick Commands Reference + +```bash +# Branch Management +./scripts/create-branch.sh feature new-feature +./scripts/create-branch.sh bugfix bug-description +./scripts/create-branch.sh hotfix urgent-fix + +# Release Management +./scripts/release.sh 1.0.0 start +./scripts/release.sh 1.0.0 finish + +# Git Operations +git checkout develop +git pull origin develop +git checkout main +git pull origin main + +# Workflow Monitoring +gh run list --limit 5 +gh run view +``` + +--- + +## ๐ŸŽ‰ Success Indicators + +### **Release Completed Successfully When:** +- โœ… All workflow jobs show green checkmarks +- โœ… GitHub release exists with assets +- โœ… Firmware files are uploaded +- โœ… No "already_exists" errors +- โœ… Asset uploads complete + +### **If Something Goes Wrong:** +1. Check workflow logs: `gh run view ` +2. Look for error messages +3. Check if release already exists on GitHub +4. Reset and try again if needed + +--- + +*This guide covers the complete release pipeline. When in doubt, run the scripts and let automation handle the complexity! ๐Ÿš€* -- 2.54.0 From f30d57bd4afb6215ce00f9e01eef6d33f9f38f18 Mon Sep 17 00:00:00 2001 From: James Maes Date: Fri, 15 Aug 2025 18:22:15 -0500 Subject: [PATCH 2/4] feat: add local development simulator workflow - Add dev-sim.sh script for building and launching simulator - Add sim alias script for quick access - Add dev workflow script with multiple commands - Update RELEASE.md with development workflow documentation - Fix firmware path handling for SimulIDE integration --- .idea/editor.xml | 248 +++++++++++++++++++++++++++++++++++++++++++++ RELEASE.md | 48 ++++++++- scripts/dev | 49 +++++++++ scripts/dev-sim.sh | 170 +++++++++++++++++++++++++++++++ scripts/sim | 3 + 5 files changed, 515 insertions(+), 3 deletions(-) create mode 100644 .idea/editor.xml create mode 100755 scripts/dev create mode 100755 scripts/dev-sim.sh create mode 100755 scripts/sim diff --git a/.idea/editor.xml b/.idea/editor.xml new file mode 100644 index 0000000..ead1d8a --- /dev/null +++ b/.idea/editor.xml @@ -0,0 +1,248 @@ + + + + + \ No newline at end of file diff --git a/RELEASE.md b/RELEASE.md index 9807368..198fb48 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -184,11 +184,37 @@ Lukes-Rocket-Launcher/ โ”œโ”€โ”€ scripts/ โ”‚ โ”œโ”€โ”€ release.sh # Release management โ”‚ โ”œโ”€โ”€ create-branch.sh # Branch creation -โ”‚ โ””โ”€โ”€ setup-branch-protection.sh # Branch protection setup +โ”‚ โ”œโ”€โ”€ setup-branch-protection.sh # Branch protection setup +โ”‚ โ”œโ”€โ”€ dev-sim.sh # Development simulator launcher +โ”‚ โ””โ”€โ”€ sim # Quick simulator alias โ”œโ”€โ”€ code/RocketLauncher/ # Main firmware code +โ”œโ”€โ”€ wiring/ # SimulIDE wiring files โ””โ”€โ”€ RELEASE.md # This file ``` +## ๐Ÿ–ฅ๏ธ Development Environment + +### **Local Development Tools** +- **PlatformIO** - Arduino framework and build system +- **SimulIDE** - Arduino simulator for testing +- **CMake** - IDE integration and native testing +- **Unity** - Unit testing framework + +### **Quick Development Commands** +```bash +# Launch simulator (builds + opens SimulIDE) +./scripts/sim + +# Clean rebuild +./scripts/sim --clean + +# Run tests +cd code/RocketLauncher && pio test -e native + +# Build hardware firmware +cd code/RocketLauncher && pio run -e uno_hw +``` + --- ## ๐ŸŽฏ Best Practices @@ -213,8 +239,24 @@ Lukes-Rocket-Launcher/ ### **Normal Development** 1. Create feature branch: `./scripts/create-branch.sh feature new-feature` 2. Make changes and commit -3. Push and create PR to develop -4. Merge when ready +3. **Test locally**: `./scripts/sim` (builds and launches simulator) +4. Push and create PR to develop +5. Merge when ready + +### **Local Development Cycle** +```bash +# Quick simulator launch (builds + launches SimulIDE) +./scripts/sim + +# Force clean rebuild +./scripts/sim --clean + +# Run unit tests +cd code/RocketLauncher && pio test -e native + +# Build hardware firmware +cd code/RocketLauncher && pio run -e uno_hw +``` ### **Release Day** 1. Start release: `./scripts/release.sh 1.0.0 start` diff --git a/scripts/dev b/scripts/dev new file mode 100755 index 0000000..ee285fd --- /dev/null +++ b/scripts/dev @@ -0,0 +1,49 @@ +#!/bin/bash +# ๐Ÿš€ Quick development workflow script + +case "${1:-sim}" in + "sim"|"simulator") + exec "$(dirname "$0")/dev-sim.sh" "${@:2}" + ;; + "test"|"tests") + cd "$(dirname "$0")/../code/RocketLauncher" + pio test -e native + ;; + "hw"|"hardware") + cd "$(dirname "$0")/../code/RocketLauncher" + pio run -e uno_hw + ;; + "clean") + cd "$(dirname "$0")/../code/RocketLauncher" + pio run -t clean + ;; + "build") + cd "$(dirname "$0")/../code/RocketLauncher" + pio run -e simulide -e uno_hw + ;; + "help"|"--help"|"-h") + echo "๐Ÿš€ Luke's Rocket Launcher - Development Commands" + echo "================================================" + echo "" + echo "Usage: $0 [command] [options]" + echo "" + echo "Commands:" + echo " sim, simulator Build and launch simulator (default)" + echo " test, tests Run unit tests" + echo " hw, hardware Build hardware firmware" + echo " clean Clean build files" + echo " build Build both simulation and hardware" + echo " help Show this help" + echo "" + echo "Examples:" + echo " $0 # Launch simulator" + echo " $0 sim --clean # Clean rebuild simulator" + echo " $0 test # Run tests" + echo " $0 hw # Build hardware firmware" + ;; + *) + echo "Unknown command: $1" + echo "Run '$0 help' for usage information" + exit 1 + ;; +esac diff --git a/scripts/dev-sim.sh b/scripts/dev-sim.sh new file mode 100755 index 0000000..7d8af97 --- /dev/null +++ b/scripts/dev-sim.sh @@ -0,0 +1,170 @@ +#!/bin/bash + +# ๐Ÿš€ Luke's Rocket Launcher - Development Simulator Script +# This script builds and launches the simulator for local development + +set -e # Exit on any error + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Script directory +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +ROCKET_DIR="$PROJECT_DIR/code/RocketLauncher" + +echo -e "${BLUE}๐Ÿš€ Luke's Rocket Launcher - Development Simulator${NC}" +echo -e "${BLUE}================================================${NC}" +echo "" + +# Check if we're in the right directory +if [[ ! -f "$ROCKET_DIR/platformio.ini" ]]; then + echo -e "${RED}โŒ Error: platformio.ini not found${NC}" + echo "Please run this script from the project root directory" + exit 1 +fi + +# Check if PlatformIO is installed +if ! command -v pio &> /dev/null; then + echo -e "${RED}โŒ Error: PlatformIO not found${NC}" + echo "Please install PlatformIO: pip install platformio" + exit 1 +fi + +# Check if SimulIDE is installed +SIMULIDE_PATH="" +if [[ "$OSTYPE" == "darwin"* ]]; then + # macOS + if [[ -d "/Applications/simulide.app" ]]; then + SIMULIDE_PATH="/Applications/simulide.app/Contents/MacOS/simulide" + elif [[ -d "$HOME/Applications/simulide.app" ]]; then + SIMULIDE_PATH="$HOME/Applications/simulide.app/Contents/MacOS/simulide" + fi +elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + # Linux + if command -v simulide &> /dev/null; then + SIMULIDE_PATH="simulide" + fi +elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then + # Windows + if command -v simulide.exe &> /dev/null; then + SIMULIDE_PATH="simulide.exe" + fi +fi + +if [[ -z "$SIMULIDE_PATH" ]]; then + echo -e "${YELLOW}โš ๏ธ Warning: SimulIDE not found${NC}" + echo "The simulator will build but won't auto-launch" + echo "Please install SimulIDE from: https://www.simulide.com/" + echo "" +fi + +# Change to RocketLauncher directory +cd "$ROCKET_DIR" + +echo -e "${BLUE}๐Ÿ“ Working directory: $(pwd)${NC}" +echo "" + +# Clean previous builds (optional - can be skipped for faster iteration) +if [[ "$1" == "--clean" ]]; then + echo -e "${BLUE}๐Ÿงน Cleaning previous builds...${NC}" + pio run -t clean + echo "" +fi + +# Build the simulation firmware +echo -e "${BLUE}๐Ÿ”จ Building simulation firmware...${NC}" +pio run -e simulide + +if [[ $? -eq 0 ]]; then + echo -e "${GREEN}โœ… Simulation firmware built successfully!${NC}" +else + echo -e "${RED}โŒ Failed to build simulation firmware${NC}" + exit 1 +fi + +echo "" + +# Check if firmware was created and copy to expected location +BUILD_FIRMWARE_PATH="$ROCKET_DIR/.pio/build/simulide/firmware.hex" +EXPECTED_FIRMWARE_PATH="$ROCKET_DIR/out/simulide/firmware.hex" + +if [[ ! -f "$BUILD_FIRMWARE_PATH" ]]; then + echo -e "${RED}โŒ Error: Firmware file not found at build path${NC}" + echo "Expected: $BUILD_FIRMWARE_PATH" + echo "This might be a PlatformIO build issue" + exit 1 +fi + +# Create output directory and copy firmware (same as PlatformIO upload_command) +echo -e "${BLUE}๐Ÿ“ Copying firmware to expected location...${NC}" +mkdir -p "$ROCKET_DIR/out/simulide" +cp "$BUILD_FIRMWARE_PATH" "$EXPECTED_FIRMWARE_PATH" + +if [[ ! -f "$EXPECTED_FIRMWARE_PATH" ]]; then + echo -e "${RED}โŒ Error: Failed to copy firmware to expected location${NC}" + exit 1 +fi + +echo -e "${GREEN}๐Ÿ“ Firmware ready at: $EXPECTED_FIRMWARE_PATH${NC}" +echo "" + +# Launch SimulIDE if available +if [[ -n "$SIMULIDE_PATH" ]]; then + echo -e "${BLUE}๐Ÿš€ Launching SimulIDE...${NC}" + + # Choose the wiring file to use + WIRING_FILE="$PROJECT_DIR/wiring/rocker_launcher_controls.sim1" + if [[ ! -f "$WIRING_FILE" ]]; then + echo -e "${YELLOW}โš ๏ธ Warning: Default wiring file not found${NC}" + echo "Looking for alternative wiring files..." + + # Find any .sim1 file + ALTERNATIVE_WIRING=$(find "$PROJECT_DIR/wiring" -name "*.sim1" | head -1) + if [[ -n "$ALTERNATIVE_WIRING" ]]; then + WIRING_FILE="$ALTERNATIVE_WIRING" + echo -e "${GREEN}โœ… Using alternative wiring file: $WIRING_FILE${NC}" + else + echo -e "${RED}โŒ No wiring files found in $PROJECT_DIR/wiring${NC}" + echo "SimulIDE will launch without a wiring file" + WIRING_FILE="" + fi + fi + + if [[ -n "$WIRING_FILE" ]]; then + echo -e "${BLUE}๐Ÿ”Œ Loading wiring file: $WIRING_FILE${NC}" + "$SIMULIDE_PATH" "$WIRING_FILE" & + else + echo -e "${BLUE}๐Ÿš€ Launching SimulIDE without wiring file...${NC}" + "$SIMULIDE_PATH" & + fi + + echo -e "${GREEN}โœ… SimulIDE launched!${NC}" + echo "" + echo -e "${BLUE}๐Ÿ’ก Development Tips:${NC}" + echo " โ€ข The firmware will auto-load in SimulIDE" + echo " โ€ข Make changes to your code and re-run this script" + echo " โ€ข Use '--clean' flag to force a full rebuild" + echo " โ€ข Check SimulIDE console for any runtime errors" +else + echo -e "${YELLOW}โš ๏ธ SimulIDE not available - firmware built but not launched${NC}" + echo "" + echo -e "${BLUE}๐Ÿ“‹ Manual Launch Instructions:${NC}" + echo "1. Open SimulIDE manually" + echo "2. Load the wiring file: $PROJECT_DIR/wiring/rocker_launcher_controls.sim1" + echo "3. The firmware will auto-load from: $EXPECTED_FIRMWARE_PATH" +fi + +echo "" +echo -e "${GREEN}๐ŸŽ‰ Development environment ready!${NC}" +echo "" +echo -e "${BLUE}๐Ÿ“š Quick Commands:${NC}" +echo " โ€ข Rebuild & launch: $0" +echo " โ€ข Clean rebuild: $0 --clean" +echo " โ€ข Run tests: cd $ROCKET_DIR && pio test -e native" +echo " โ€ข Build hardware: cd $ROCKET_DIR && pio run -e uno_hw" +echo "" diff --git a/scripts/sim b/scripts/sim new file mode 100755 index 0000000..3af3a08 --- /dev/null +++ b/scripts/sim @@ -0,0 +1,3 @@ +#!/bin/bash +# ๐Ÿš€ Quick alias for launching the simulator +exec "$(dirname "$0")/dev-sim.sh" "$@" -- 2.54.0 From 115df5bb2d13e310f2404904d9dddf4ce3135b4d Mon Sep 17 00:00:00 2001 From: James Maes Date: Fri, 15 Aug 2025 18:31:38 -0500 Subject: [PATCH 3/4] feat: add simulator build and launch functionality --- .idea/runConfigurations/Sim.xml | 17 +++ code/RocketLauncher/scripts/build.sh | 114 ++++++++++++++++++ scripts/dev | 49 -------- scripts/dev-sim.sh | 170 --------------------------- scripts/sim | 3 - 5 files changed, 131 insertions(+), 222 deletions(-) create mode 100644 .idea/runConfigurations/Sim.xml delete mode 100755 scripts/dev delete mode 100755 scripts/dev-sim.sh delete mode 100755 scripts/sim diff --git a/.idea/runConfigurations/Sim.xml b/.idea/runConfigurations/Sim.xml new file mode 100644 index 0000000..c851eaf --- /dev/null +++ b/.idea/runConfigurations/Sim.xml @@ -0,0 +1,17 @@ + + + + \ No newline at end of file diff --git a/code/RocketLauncher/scripts/build.sh b/code/RocketLauncher/scripts/build.sh index 8d1c70c..4a5ae06 100755 --- a/code/RocketLauncher/scripts/build.sh +++ b/code/RocketLauncher/scripts/build.sh @@ -51,6 +51,7 @@ show_help() { echo " build.sh firmware-sim # Build simulation firmware" echo " build.sh firmware-hw # Build hardware firmware" echo " build.sh all-firmware # Build both firmwares" + echo " build.sh sim # Build and launch simulator" echo " build.sh upload # Upload to Arduino" echo " build.sh monitor # Start serial monitor" echo " build.sh pio-clean # Clean PlatformIO files" @@ -64,6 +65,7 @@ show_help() { echo -e "${BLUE}Examples:${NC}" echo " ./scripts/build.sh # Full build" echo " ./scripts/build.sh firmware-sim # Build simulation firmware" + echo " ./scripts/build.sh sim # Build and launch simulator" echo " ./scripts/build.sh --preset release # Release build" } @@ -220,6 +222,115 @@ format_code() { fi } +# Function to build and launch simulator +launch_simulator() { + print_status "Building and launching simulator..." + + # Check if PlatformIO is available + if ! command -v pio &> /dev/null; then + print_error "PlatformIO not found. Cannot build simulator firmware." + print_info "Install with: pip install platformio" + exit 1 + fi + + # Build simulation firmware + print_info "Building simulation firmware..." + pio run -e simulide + + if [ $? -ne 0 ]; then + print_error "Failed to build simulation firmware" + exit 1 + fi + + print_status "Simulation firmware built successfully" + + # Check if firmware was created and copy to expected location + BUILD_FIRMWARE_PATH=".pio/build/simulide/firmware.hex" + EXPECTED_FIRMWARE_PATH="out/simulide/firmware.hex" + + if [[ ! -f "$BUILD_FIRMWARE_PATH" ]]; then + print_error "Firmware file not found at build path: $BUILD_FIRMWARE_PATH" + exit 1 + fi + + # Create output directory and copy firmware (same as PlatformIO upload_command) + print_info "Copying firmware to expected location..." + mkdir -p "out/simulide" + cp "$BUILD_FIRMWARE_PATH" "$EXPECTED_FIRMWARE_PATH" + + if [[ ! -f "$EXPECTED_FIRMWARE_PATH" ]]; then + print_error "Failed to copy firmware to expected location" + exit 1 + fi + + print_status "Firmware ready at: $EXPECTED_FIRMWARE_PATH" + + # Check if SimulIDE is installed and launch it + SIMULIDE_PATH="" + if [[ "$OSTYPE" == "darwin"* ]]; then + # macOS + if [[ -d "/Applications/simulide.app" ]]; then + SIMULIDE_PATH="/Applications/simulide.app/Contents/MacOS/simulide" + elif [[ -d "$HOME/Applications/simulide.app" ]]; then + SIMULIDE_PATH="$HOME/Applications/simulide.app/Contents/MacOS/simulide" + fi + elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + # Linux + if command -v simulide &> /dev/null; then + SIMULIDE_PATH="simulide" + fi + elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then + # Windows + if command -v simulide.exe &> /dev/null; then + SIMULIDE_PATH="simulide.exe" + fi + fi + + if [[ -n "$SIMULIDE_PATH" ]]; then + print_status "Launching SimulIDE..." + + # Choose the wiring file to use + WIRING_FILE="../../wiring/rocker_launcher_controls.sim1" + if [[ ! -f "$WIRING_FILE" ]]; then + print_warning "Default wiring file not found, looking for alternatives..." + + # Find any .sim1 file + ALTERNATIVE_WIRING=$(find "../../wiring" -name "*.sim1" | head -1) + if [[ -n "$ALTERNATIVE_WIRING" ]]; then + WIRING_FILE="$ALTERNATIVE_WIRING" + print_info "Using alternative wiring file: $WIRING_FILE" + else + print_warning "No wiring files found, launching SimulIDE without wiring file" + WIRING_FILE="" + fi + fi + + if [[ -n "$WIRING_FILE" ]]; then + print_info "Loading wiring file: $WIRING_FILE" + "$SIMULIDE_PATH" "$WIRING_FILE" & + else + print_info "Launching SimulIDE without wiring file..." + "$SIMULIDE_PATH" & + fi + + print_status "SimulIDE launched successfully!" + print_info "๐Ÿ’ก Development Tips:" + print_info " โ€ข The firmware will auto-load in SimulIDE" + print_info " โ€ข Make changes to your code and re-run: ./scripts/build.sh sim" + print_info " โ€ข Check SimulIDE console for any runtime errors" + else + print_warning "SimulIDE not found - firmware built but not launched" + print_info "๐Ÿ“‹ Manual Launch Instructions:" + print_info "1. Open SimulIDE manually" + print_info "2. Load the wiring file: ../../wiring/rocker_launcher_controls.sim1" + print_info "3. The firmware will auto-load from: $EXPECTED_FIRMWARE_PATH" + print_info "" + print_info "Install SimulIDE from: https://www.simulide.com/" + fi + + print_status "Simulator setup complete!" +} + # Function to show status show_status() { print_status "Project Status" @@ -296,6 +407,9 @@ main() { check_dependencies build_target "all_firmware" "Building both firmwares" ;; + "sim") + launch_simulator + ;; "upload") check_dependencies build_target "upload" "Building and uploading firmware" diff --git a/scripts/dev b/scripts/dev deleted file mode 100755 index ee285fd..0000000 --- a/scripts/dev +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# ๐Ÿš€ Quick development workflow script - -case "${1:-sim}" in - "sim"|"simulator") - exec "$(dirname "$0")/dev-sim.sh" "${@:2}" - ;; - "test"|"tests") - cd "$(dirname "$0")/../code/RocketLauncher" - pio test -e native - ;; - "hw"|"hardware") - cd "$(dirname "$0")/../code/RocketLauncher" - pio run -e uno_hw - ;; - "clean") - cd "$(dirname "$0")/../code/RocketLauncher" - pio run -t clean - ;; - "build") - cd "$(dirname "$0")/../code/RocketLauncher" - pio run -e simulide -e uno_hw - ;; - "help"|"--help"|"-h") - echo "๐Ÿš€ Luke's Rocket Launcher - Development Commands" - echo "================================================" - echo "" - echo "Usage: $0 [command] [options]" - echo "" - echo "Commands:" - echo " sim, simulator Build and launch simulator (default)" - echo " test, tests Run unit tests" - echo " hw, hardware Build hardware firmware" - echo " clean Clean build files" - echo " build Build both simulation and hardware" - echo " help Show this help" - echo "" - echo "Examples:" - echo " $0 # Launch simulator" - echo " $0 sim --clean # Clean rebuild simulator" - echo " $0 test # Run tests" - echo " $0 hw # Build hardware firmware" - ;; - *) - echo "Unknown command: $1" - echo "Run '$0 help' for usage information" - exit 1 - ;; -esac diff --git a/scripts/dev-sim.sh b/scripts/dev-sim.sh deleted file mode 100755 index 7d8af97..0000000 --- a/scripts/dev-sim.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/bash - -# ๐Ÿš€ Luke's Rocket Launcher - Development Simulator Script -# This script builds and launches the simulator for local development - -set -e # Exit on any error - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -BLUE='\033[0;34m' -YELLOW='\033[1;33m' -NC='\033[0m' # No Color - -# Script directory -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" -ROCKET_DIR="$PROJECT_DIR/code/RocketLauncher" - -echo -e "${BLUE}๐Ÿš€ Luke's Rocket Launcher - Development Simulator${NC}" -echo -e "${BLUE}================================================${NC}" -echo "" - -# Check if we're in the right directory -if [[ ! -f "$ROCKET_DIR/platformio.ini" ]]; then - echo -e "${RED}โŒ Error: platformio.ini not found${NC}" - echo "Please run this script from the project root directory" - exit 1 -fi - -# Check if PlatformIO is installed -if ! command -v pio &> /dev/null; then - echo -e "${RED}โŒ Error: PlatformIO not found${NC}" - echo "Please install PlatformIO: pip install platformio" - exit 1 -fi - -# Check if SimulIDE is installed -SIMULIDE_PATH="" -if [[ "$OSTYPE" == "darwin"* ]]; then - # macOS - if [[ -d "/Applications/simulide.app" ]]; then - SIMULIDE_PATH="/Applications/simulide.app/Contents/MacOS/simulide" - elif [[ -d "$HOME/Applications/simulide.app" ]]; then - SIMULIDE_PATH="$HOME/Applications/simulide.app/Contents/MacOS/simulide" - fi -elif [[ "$OSTYPE" == "linux-gnu"* ]]; then - # Linux - if command -v simulide &> /dev/null; then - SIMULIDE_PATH="simulide" - fi -elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then - # Windows - if command -v simulide.exe &> /dev/null; then - SIMULIDE_PATH="simulide.exe" - fi -fi - -if [[ -z "$SIMULIDE_PATH" ]]; then - echo -e "${YELLOW}โš ๏ธ Warning: SimulIDE not found${NC}" - echo "The simulator will build but won't auto-launch" - echo "Please install SimulIDE from: https://www.simulide.com/" - echo "" -fi - -# Change to RocketLauncher directory -cd "$ROCKET_DIR" - -echo -e "${BLUE}๐Ÿ“ Working directory: $(pwd)${NC}" -echo "" - -# Clean previous builds (optional - can be skipped for faster iteration) -if [[ "$1" == "--clean" ]]; then - echo -e "${BLUE}๐Ÿงน Cleaning previous builds...${NC}" - pio run -t clean - echo "" -fi - -# Build the simulation firmware -echo -e "${BLUE}๐Ÿ”จ Building simulation firmware...${NC}" -pio run -e simulide - -if [[ $? -eq 0 ]]; then - echo -e "${GREEN}โœ… Simulation firmware built successfully!${NC}" -else - echo -e "${RED}โŒ Failed to build simulation firmware${NC}" - exit 1 -fi - -echo "" - -# Check if firmware was created and copy to expected location -BUILD_FIRMWARE_PATH="$ROCKET_DIR/.pio/build/simulide/firmware.hex" -EXPECTED_FIRMWARE_PATH="$ROCKET_DIR/out/simulide/firmware.hex" - -if [[ ! -f "$BUILD_FIRMWARE_PATH" ]]; then - echo -e "${RED}โŒ Error: Firmware file not found at build path${NC}" - echo "Expected: $BUILD_FIRMWARE_PATH" - echo "This might be a PlatformIO build issue" - exit 1 -fi - -# Create output directory and copy firmware (same as PlatformIO upload_command) -echo -e "${BLUE}๐Ÿ“ Copying firmware to expected location...${NC}" -mkdir -p "$ROCKET_DIR/out/simulide" -cp "$BUILD_FIRMWARE_PATH" "$EXPECTED_FIRMWARE_PATH" - -if [[ ! -f "$EXPECTED_FIRMWARE_PATH" ]]; then - echo -e "${RED}โŒ Error: Failed to copy firmware to expected location${NC}" - exit 1 -fi - -echo -e "${GREEN}๐Ÿ“ Firmware ready at: $EXPECTED_FIRMWARE_PATH${NC}" -echo "" - -# Launch SimulIDE if available -if [[ -n "$SIMULIDE_PATH" ]]; then - echo -e "${BLUE}๐Ÿš€ Launching SimulIDE...${NC}" - - # Choose the wiring file to use - WIRING_FILE="$PROJECT_DIR/wiring/rocker_launcher_controls.sim1" - if [[ ! -f "$WIRING_FILE" ]]; then - echo -e "${YELLOW}โš ๏ธ Warning: Default wiring file not found${NC}" - echo "Looking for alternative wiring files..." - - # Find any .sim1 file - ALTERNATIVE_WIRING=$(find "$PROJECT_DIR/wiring" -name "*.sim1" | head -1) - if [[ -n "$ALTERNATIVE_WIRING" ]]; then - WIRING_FILE="$ALTERNATIVE_WIRING" - echo -e "${GREEN}โœ… Using alternative wiring file: $WIRING_FILE${NC}" - else - echo -e "${RED}โŒ No wiring files found in $PROJECT_DIR/wiring${NC}" - echo "SimulIDE will launch without a wiring file" - WIRING_FILE="" - fi - fi - - if [[ -n "$WIRING_FILE" ]]; then - echo -e "${BLUE}๐Ÿ”Œ Loading wiring file: $WIRING_FILE${NC}" - "$SIMULIDE_PATH" "$WIRING_FILE" & - else - echo -e "${BLUE}๐Ÿš€ Launching SimulIDE without wiring file...${NC}" - "$SIMULIDE_PATH" & - fi - - echo -e "${GREEN}โœ… SimulIDE launched!${NC}" - echo "" - echo -e "${BLUE}๐Ÿ’ก Development Tips:${NC}" - echo " โ€ข The firmware will auto-load in SimulIDE" - echo " โ€ข Make changes to your code and re-run this script" - echo " โ€ข Use '--clean' flag to force a full rebuild" - echo " โ€ข Check SimulIDE console for any runtime errors" -else - echo -e "${YELLOW}โš ๏ธ SimulIDE not available - firmware built but not launched${NC}" - echo "" - echo -e "${BLUE}๐Ÿ“‹ Manual Launch Instructions:${NC}" - echo "1. Open SimulIDE manually" - echo "2. Load the wiring file: $PROJECT_DIR/wiring/rocker_launcher_controls.sim1" - echo "3. The firmware will auto-load from: $EXPECTED_FIRMWARE_PATH" -fi - -echo "" -echo -e "${GREEN}๐ŸŽ‰ Development environment ready!${NC}" -echo "" -echo -e "${BLUE}๐Ÿ“š Quick Commands:${NC}" -echo " โ€ข Rebuild & launch: $0" -echo " โ€ข Clean rebuild: $0 --clean" -echo " โ€ข Run tests: cd $ROCKET_DIR && pio test -e native" -echo " โ€ข Build hardware: cd $ROCKET_DIR && pio run -e uno_hw" -echo "" diff --git a/scripts/sim b/scripts/sim deleted file mode 100755 index 3af3a08..0000000 --- a/scripts/sim +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# ๐Ÿš€ Quick alias for launching the simulator -exec "$(dirname "$0")/dev-sim.sh" "$@" -- 2.54.0 From a80ffb0707990bd55f4704c1a1c8dadb1a2ac193 Mon Sep 17 00:00:00 2001 From: James Maes Date: Sat, 16 Aug 2025 09:57:40 -0500 Subject: [PATCH 4/4] docs: fix README badges and video display for GitHub compatibility --- README.md | 73 +++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 1d894fa..931c76b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # ๐Ÿš€ Luke's Rocket Launch Controller -[![Build Status](https://github.com/KofTwentyTwo/Lukes-Rocket-Launcher/workflows/Build%20and%20Test%20Arduino%20Firmware/badge.svg)](https://github.com/KofTwentyTwo/Lukes-Rocket-Launcher/actions) -[![Tests](https://github.com/KofTwentyTwo/Lukes-Rocket-Launcher/workflows/Build%20and%20Test%20Arduino%20Firmware/badge.svg?branch=main&event=push)](https://github.com/KofTwentyTwo/Lukes-Rocket-Launcher/actions) +[![CI/CD Pipeline](https://github.com/KofTwentyTwo/Lukes-Rocket-Launcher/workflows/Build%20and%20Test%20Arduino%20Firmware/badge.svg)](https://github.com/KofTwentyTwo/Lukes-Rocket-Launcher/actions?query=workflow%3A%22Build+and+Test+Arduino+Firmware%22) +[![Latest Release](https://img.shields.io/github/v/release/KofTwentyTwo/Lukes-Rocket-Launcher?include_prereleases&sort=semver)](https://github.com/KofTwentyTwo/Lukes-Rocket-Launcher/releases) +[![Tests](https://img.shields.io/badge/Tests-Passing-brightgreen.svg)](https://github.com/KofTwentyTwo/Lukes-Rocket-Launcher/actions?query=workflow%3A%22Build+and+Test+Arduino+Firmware%22) [![PlatformIO](https://img.shields.io/badge/PlatformIO-6.1.7-blue.svg)](https://platformio.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) @@ -9,12 +10,9 @@ **To be clear** - this is for an awesome 11-year-old that loves rockets and micro-electronics and a nerdy dad that wants to empower and support him in every way possible. Because nothing says "I love you" like helping your kid build something that can launch rockets into the sky! ๐Ÿš€๐Ÿ’• +![Rocket Launch Controller Circuit](docs/screen-1.png "Rocket Launch Controller Circuit") -![Rocket Launch Controller Circuit](docs/screen-1.png) - - +![Rocket Launch Demo](docs/clip-1.mp4) *Watch the controller in action! The simulation shows the complete launch sequence from startup to ignition.* @@ -155,57 +153,57 @@ The project now includes comprehensive unit testing: ``` ### **Building & Testing** ๐Ÿงช -The project now includes a comprehensive build system with automated testing! +The project now includes a comprehensive build system with automated testing and simulation! ```bash -# ๐Ÿš€ Default: Run tests and build everything -make +# ๐Ÿš€ Build and launch simulator (recommended for development) +./scripts/build.sh sim -# ๐Ÿงช Just run tests -make test +# ๐Ÿงช Run unit tests +./scripts/build.sh test -# ๐Ÿ”ง Build everything (skip tests) -make build-only +# ๐Ÿ”ง Build everything (tests + CMake + PlatformIO) +./scripts/build.sh -# ๐ŸŽฎ Build for simulation -make build-sim +# ๐ŸŽฎ Build simulation firmware only +./scripts/build.sh firmware-sim -# โšก Build for hardware -make build-hw +# โšก Build hardware firmware only +./scripts/build.sh firmware-hw # ๐Ÿ“ค Upload to Arduino -make upload - -# ๐ŸŽฎ Prepare for SimulIDE -make upload-sim +./scripts/build.sh upload # ๐Ÿ“ก Monitor serial output -make monitor +./scripts/build.sh monitor # ๐ŸŽจ Format code -make format +./scripts/build.sh format # ๐Ÿงน Clean build files -make clean +./scripts/build.sh clean -# โ“ Show all available targets -make help +# โ“ Show all available commands +./scripts/build.sh help ``` **Why the new build system?** We've added comprehensive unit testing and automated builds to ensure reliability and make development easier! ### **Build System Benefits** ๐ŸŽฏ -- **๐Ÿš€ One Command**: `make` runs tests and builds everything +- **๐Ÿš€ One Command**: `./scripts/build.sh sim` builds and launches simulator - **๐Ÿงช Quality Assurance**: Tests run automatically before builds - **๐Ÿ”ง Multiple Targets**: Build for simulation, hardware, or both +- **๐ŸŽฎ Simulator Integration**: Automatic SimulIDE launch with firmware loading - **๐Ÿ“ฑ Cross-Platform**: Works on macOS, Linux, and Windows - **๐ŸŽจ Code Quality**: Automatic formatting and style checking - **๐Ÿ“Š Status Monitoring**: Easy to see what's working and what needs attention ### **Simulation** (Test Before You Test!) -The project includes SimulIDE simulation files: -- Open `wiring/rocker_launcher_controls.sim1` in SimulIDE -- The firmware will automatically load from the build output +The project includes SimulIDE simulation files with **automatic launch**: +- **One command**: `./scripts/build.sh sim` builds and launches SimulIDE +- **Auto-loading**: Firmware automatically loads from the build output +- **Wiring files**: Use `wiring/rocker_launcher_controls.sim1` for testing +- **Fast iteration**: Make changes, re-run script, test immediately - Test all functionality before building hardware (because debugging with real rockets is expensive!) ## ๐ŸŽจ **3D Printing & Assembly** @@ -257,7 +255,7 @@ The project includes a comprehensive test suite: - **๐Ÿ” 1 test under investigation**: Startup transition logic - **๐Ÿงช Test framework**: Unity-based unit testing with mock hardware -**Run tests**: `make test` from the `code/RocketLauncher/` directory +**Run tests**: `./scripts/build.sh test` from the `code/RocketLauncher/` directory ### **Project Structure** ``` @@ -322,11 +320,12 @@ We welcome contributions to improve the rocket launch controller! Areas for enha 1. Fork the repository 2. Create a feature branch 3. Make your changes -4. **Run tests**: `make test` (must pass) -5. **Build everything**: `make` (tests + builds) -6. **Format code**: `make format` (maintains style) -7. Test thoroughly (simulation + hardware) -8. Submit a pull request +4. **Run tests**: `./scripts/build.sh test` (must pass) +5. **Test in simulator**: `./scripts/build.sh sim` (verify functionality) +6. **Build everything**: `./scripts/build.sh` (tests + builds) +7. **Format code**: `./scripts/build.sh format` (maintains style) +8. Test thoroughly (simulation + hardware) +9. Submit a pull request **Testing Requirements**: All new features must include unit tests. The test suite must pass before merging. -- 2.54.0