A newer version of the Gradio SDK is available:
6.2.0
GitHub CI Workflow Improvements
Summary
Fixed both GitHub CI workflows (.github/workflows/ci.yml and .github/workflows/ci-full.yml) to use modern best practices and resolve several issues.
Issues Fixed
ci.yml (Basic CI)
Before:
- Used
uv pip install --systemwhich is not recommended in CI environments - Ran tools directly instead of through
uv run - Used
pip install uvinstead of the official action - Inconsistent Python version handling between jobs
- Missing error handling for coverage uploads
After:
- β
Uses
astral-sh/setup-uv@v4official action with caching - β
Creates proper virtual environments with
uv venv - β
All tools run through
uv runfor consistency - β
Proper error handling with
fail_ci_if_error: false - β Optimized artifact uploads (only for Python 3.11)
- β
Better output formatting with
--output-format=githubfor Ruff
ci-full.yml (Full CI with External Dependencies)
Before:
- Workflow was disabled (manual trigger only)
- Overcomplicated uv usage with unnecessary
uv pip compilesteps - Hardcoded Python versions ("3.11.8")
- Redundant dependency installation steps
After:
- β Enabled for automatic triggering on pushes and PRs
- β Simplified uv usage - direct installation from requirements files
- β Uses environment variables for Python version consistency
- β Improved error handling for missing files
- β Better structured with proper caching
Key Improvements
1. Modern uv Usage
# Before
- name: Install uv
run: pip install uv
- name: Install dependencies
run: |
uv pip install --system -r requirements.txt
# After
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
- name: Create virtual environment and install dependencies
run: |
uv venv
uv pip install -r requirements.txt
2. Consistent Tool Execution
# Before
run: ruff check .
# After
run: uv run ruff check . --output-format=github
3. Environment Variables
env:
PYTHON_VERSION: "3.11"
FORCE_COLOR: 1
4. Better Error Handling
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == env.PYTHON_VERSION
with:
fail_ci_if_error: false
Workflow Structure
ci.yml (Basic)
- lint: Code quality checks (Ruff, Black, MyPy)
- test: Unit tests with PostgreSQL/Redis services
- security: Security scans (Bandit, Trivy)
- docker: Container builds on develop branch
ci-full.yml (Comprehensive)
- test: Full test suite with matrix strategy
- integration-tests: E2E and integration testing
- security: Enhanced security scanning with secrets detection
- deployment-prep: Validates deployment readiness
- pr-checks: Enforces PR title and branch naming conventions
- success: Final status check for all jobs
Benefits
- Reliability: Proper virtual environment isolation
- Performance: Caching enabled for uv and dependencies
- Consistency: All tools run through
uv run - Maintainability: Environment variables for version management
- Visibility: Better error reporting and GitHub integration
- Security: Enhanced security scanning and secrets detection
Recommendations
1. Required Secrets
Ensure these secrets are configured in your repository:
CODECOV_TOKEN: For coverage reporting
2. Branch Protection
Configure branch protection rules to require:
- Status checks from both workflows
- PR reviews before merging
- Up-to-date branches
3. Additional Enhancements
Consider adding:
- Dependabot for dependency updates
- CodeQL analysis for security
- Performance regression testing
- Deployment automation for staging/production
4. Local Development
Ensure developers use the same tools locally:
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create environment and install dependencies
uv venv
uv pip install -r requirements.txt -r requirements-dev.txt
# Run quality checks
uv run ruff check .
uv run black --check .
uv run mypy .
uv run pytest
Files Modified
.github/workflows/ci.yml- Basic CI workflow.github/workflows/ci-full.yml- Full CI workflow with external dependencies
Next Steps
- Test the workflows with a sample PR
- Verify all required secrets are configured
- Update documentation to reflect new CI requirements
- Consider enabling automated deployments for successful builds