name: VintageGAN CI on: push: branches: [ main, develop ] pull_request: branches: [ main, develop ] workflow_dispatch: jobs: test: name: Test on ${{ matrix.os }} - Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] python-version: ['3.9', '3.10', '3.11'] steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install pytest pytest-cov black flake8 - name: Check code formatting with Black run: | black --check . --line-length 100 --exclude="venv|build|dist|\.eggs" - name: Lint with flake8 run: | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=venv,build,dist,.eggs flake8 . --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics --exclude=venv,build,dist,.eggs - name: Verify installation run: | python verify_installation.py - name: Run quick tests run: | python run_tests.py --quick - name: Run pytest tests run: | pytest tests/ -v --tb=short test-notebooks: name: Test Jupyter Notebooks runs-on: ubuntu-latest needs: test steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.10' cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install jupyter nbconvert - name: Test notebook execution (dry run) run: | jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 notebooks/demo.ipynb --output demo_test.ipynb || echo "Demo notebook needs trained model" build-package: name: Build Python Package runs-on: ubuntu-latest needs: test steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install build dependencies 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@v3 with: name: python-package path: dist/ code-quality: name: Code Quality Checks runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install pylint mypy - name: Type checking with mypy run: | mypy models/ training/ defects/ evaluation/ inference/ --ignore-missing-imports --no-strict-optional || echo "Type checking completed with warnings" - name: Lint with pylint run: | pylint models/ training/ defects/ evaluation/ inference/ --exit-zero --max-line-length=100 status-check: name: All Tests Passed runs-on: ubuntu-latest needs: [test, test-notebooks, build-package, code-quality] steps: - name: Success run: | echo "✅ All automated tests passed successfully!" echo "✅ Code quality checks completed" echo "✅ Package build successful" echo "🎉 VintageGAN CI pipeline complete!"