| 
 | 1 | +# Building and Testing Container Compose Plugin  | 
 | 2 | + | 
 | 3 | +## Prerequisites  | 
 | 4 | + | 
 | 5 | +- macOS 15 or later  | 
 | 6 | +- Swift 6.2 or later  | 
 | 7 | +- Main container project dependencies  | 
 | 8 | + | 
 | 9 | +## Building  | 
 | 10 | + | 
 | 11 | +### From the main project root:  | 
 | 12 | + | 
 | 13 | +```bash  | 
 | 14 | +# Build everything including the plugin  | 
 | 15 | +make all  | 
 | 16 | + | 
 | 17 | +# Build only the compose plugin  | 
 | 18 | +make plugin-compose  | 
 | 19 | + | 
 | 20 | +# Clean build  | 
 | 21 | +make clean  | 
 | 22 | +```  | 
 | 23 | + | 
 | 24 | +### From the plugin directory:  | 
 | 25 | + | 
 | 26 | +```bash  | 
 | 27 | +cd Plugins/container-compose  | 
 | 28 | + | 
 | 29 | +# Build in debug mode  | 
 | 30 | +swift build  | 
 | 31 | + | 
 | 32 | +# Build in release mode  | 
 | 33 | +swift build -c release  | 
 | 34 | + | 
 | 35 | +# Run the plugin directly  | 
 | 36 | +    .build/debug/compose --help  | 
 | 37 | +```  | 
 | 38 | + | 
 | 39 | +## Testing  | 
 | 40 | + | 
 | 41 | +### Run tests from plugin directory:  | 
 | 42 | + | 
 | 43 | +```bash  | 
 | 44 | +cd Plugins/container-compose  | 
 | 45 | + | 
 | 46 | +# Run all tests  | 
 | 47 | +swift test  | 
 | 48 | + | 
 | 49 | +# Run specific test  | 
 | 50 | +swift test --filter ComposeParserTests  | 
 | 51 | + | 
 | 52 | +# Run with verbose output  | 
 | 53 | +swift test --verbose  | 
 | 54 | +```  | 
 | 55 | + | 
 | 56 | +### Manual testing:  | 
 | 57 | + | 
 | 58 | +1. Build the plugin:  | 
 | 59 | +   ```bash  | 
 | 60 | +   swift build  | 
 | 61 | +   ```  | 
 | 62 | + | 
 | 63 | +2. Test basic functionality:  | 
 | 64 | +   ```bash  | 
 | 65 | +   # Validate a compose file  | 
 | 66 | +    .build/debug/compose validate -f test-compose.yml  | 
 | 67 | +     | 
 | 68 | +   # Show help  | 
 | 69 | +    .build/debug/compose --help  | 
 | 70 | +    .build/debug/compose up --help  | 
 | 71 | +   ```  | 
 | 72 | + | 
 | 73 | +## Installation  | 
 | 74 | + | 
 | 75 | +### Via main project install:  | 
 | 76 | + | 
 | 77 | +```bash  | 
 | 78 | +# From main project root  | 
 | 79 | +make install  | 
 | 80 | +```  | 
 | 81 | + | 
 | 82 | +This installs the plugin to: `/usr/local/libexec/container/plugins/compose/`  | 
 | 83 | + | 
 | 84 | +### Manual installation:  | 
 | 85 | + | 
 | 86 | +```bash  | 
 | 87 | +# Build in release mode  | 
 | 88 | +cd Plugins/container-compose  | 
 | 89 | +swift build -c release  | 
 | 90 | + | 
 | 91 | +# Copy to plugin directory  | 
 | 92 | +sudo mkdir -p /usr/local/libexec/container/plugins/compose/bin  | 
 | 93 | +sudo cp .build/release/compose /usr/local/libexec/container/plugins/compose/bin/  | 
 | 94 | +sudo cp config.json /usr/local/libexec/container/plugins/compose/  | 
 | 95 | +```  | 
 | 96 | + | 
 | 97 | +## Integration Testing  | 
 | 98 | + | 
 | 99 | +After installation, test the plugin integration:  | 
 | 100 | + | 
 | 101 | +```bash  | 
 | 102 | +# Should work through main container CLI  | 
 | 103 | +container compose --help  | 
 | 104 | +container compose up --help  | 
 | 105 | + | 
 | 106 | +# Create a test compose file  | 
 | 107 | +cat > test-compose.yml << 'EOF'  | 
 | 108 | +version: '3'  | 
 | 109 | +services:  | 
 | 110 | +  web:  | 
 | 111 | +    image: nginx:alpine  | 
 | 112 | +    ports:  | 
 | 113 | +      - "8080:80"  | 
 | 114 | +EOF  | 
 | 115 | + | 
 | 116 | +# Test compose commands  | 
 | 117 | +container compose validate -f test-compose.yml  | 
 | 118 | +container compose up -d -f test-compose.yml  | 
 | 119 | +container compose ps -f test-compose.yml  | 
 | 120 | +container compose down -f test-compose.yml  | 
 | 121 | +```  | 
 | 122 | + | 
 | 123 | +## Troubleshooting  | 
 | 124 | + | 
 | 125 | +### Build Errors  | 
 | 126 | + | 
 | 127 | +1. **Missing dependencies**: Ensure the main container project is built first  | 
 | 128 | +   ```bash  | 
 | 129 | +   cd ../..  | 
 | 130 | +   swift build  | 
 | 131 | +   ```  | 
 | 132 | + | 
 | 133 | +2. **Swift version**: Check Swift version  | 
 | 134 | +   ```bash  | 
 | 135 | +   swift --version  | 
 | 136 | +   ```  | 
 | 137 | + | 
 | 138 | +3. **Clean build**: Try a clean build  | 
 | 139 | +   ```bash  | 
 | 140 | +   swift package clean  | 
 | 141 | +   swift build  | 
 | 142 | +   ```  | 
 | 143 | + | 
 | 144 | +### Runtime Errors  | 
 | 145 | + | 
 | 146 | +1. **Plugin not found**: Check installation path  | 
 | 147 | +   ```bash  | 
 | 148 | +    ls -la /usr/local/libexec/container/plugins/compose/  | 
 | 149 | +   ```  | 
 | 150 | + | 
 | 151 | +2. **Permission issues**: Ensure proper permissions  | 
 | 152 | +   ```bash  | 
 | 153 | +    sudo chmod +x /usr/local/libexec/container/plugins/compose/bin/compose  | 
 | 154 | +   ```  | 
 | 155 | + | 
 | 156 | +3. **Debug output**: Enable debug logging  | 
 | 157 | +   ```bash  | 
 | 158 | +   container compose --debug up  | 
 | 159 | +   ```  | 
 | 160 | + | 
 | 161 | +## Development Workflow  | 
 | 162 | + | 
 | 163 | +1. Make changes to the plugin code  | 
 | 164 | +2. Build and test locally:  | 
 | 165 | +   ```bash  | 
 | 166 | +   swift build && swift test  | 
 | 167 | +   ```  | 
 | 168 | +3. Test integration:  | 
 | 169 | +   ```bash  | 
 | 170 | +   make -C ../.. plugin-compose  | 
 | 171 | +   sudo make -C ../.. install  | 
 | 172 | +   container compose --help  | 
 | 173 | +   ```  | 
 | 174 | +4. Submit changes via PR  | 
 | 175 | + | 
 | 176 | +## Notes  | 
 | 177 | + | 
 | 178 | +- The plugin uses a stub for ProgressBar to avoid dependencies on internal APIs  | 
 | 179 | +- All compose functionality is self-contained in the plugin  | 
 | 180 | +- The plugin can be developed and tested independently of the main project  | 
0 commit comments