name: CI/CD Pipeline on: push: branches: [ main, dev, 'claude/**' ] pull_request: branches: [ main, dev ] jobs: lint: name: Code Quality & Linting runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip pip install yapf black isort mypy - name: Check formatting with YAPF run: | yapf --diff --recursive wan/ tests/ continue-on-error: true - name: Check formatting with Black run: | black --check wan/ tests/ continue-on-error: true - name: Check import sorting with isort run: | isort --check-only wan/ tests/ continue-on-error: true - name: Type check with mypy run: | mypy wan/ continue-on-error: true test-cpu: name: CPU Tests runs-on: ubuntu-latest strategy: matrix: python-version: ['3.10', '3.11'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip' - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y libavformat-dev libavcodec-dev libavutil-dev libswscale-dev - name: Install Python dependencies (CPU-only) run: | python -m pip install --upgrade pip pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu pip install -e .[dev] - name: Run unit tests run: | pytest tests/ -v -m "not cuda and not requires_model and not integration" --tb=short - name: Run import tests run: | python -c "from wan.modules.model import WanModel; print('WanModel import OK')" python -c "from wan.modules.vae import WanVAE_; print('WanVAE import OK')" python -c "from wan.modules.attention import attention; print('attention import OK')" python -c "from wan.text2video import WanT2V; print('WanT2V import OK')" python -c "from wan.image2video import WanI2V; print('WanI2V import OK')" test-gpu: name: GPU Tests (CUDA) runs-on: ubuntu-latest # Note: This requires a self-hosted runner with GPU access # For public CI, this job can be skipped if: false # Disable by default (enable for self-hosted runners with GPU) steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install CUDA dependencies run: | # Add CUDA installation steps here echo "CUDA installation required" - name: Install Python dependencies run: | python -m pip install --upgrade pip pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118 pip install -e .[dev] - name: Run GPU tests run: | pytest tests/ -v -m "cuda" --tb=short security: name: Security Scanning runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install safety bandit - name: Run safety check run: | pip install -e . safety check --json || true continue-on-error: true - name: Run bandit security scan run: | bandit -r wan/ -f json || true continue-on-error: true build: name: Build Package runs-on: ubuntu-latest needs: [lint, test-cpu] steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install build tools run: | python -m pip install --upgrade pip pip install build twine - name: Build package run: | python -m build - name: Check package run: | twine check dist/* - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: python-package-distributions path: dist/ docs: name: Build Documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install sphinx sphinx-rtd-theme - name: Build documentation run: | # Add sphinx build commands when docs/ is set up echo "Documentation build placeholder" continue-on-error: true