CI CD - auraz/autodoc_ai GitHub Wiki
Continuous Integration and Continuous Deployment (CI/CD)
This guide explains the CI/CD setup for the autodoc_ai
project, helping contributors understand how automated testing and deployment works.
Overview
Continuous Integration (CI) automatically builds and tests code changes, while Continuous Deployment (CD) automatically deploys approved changes to production environments. For autodoc_ai
, we use GitHub Actions to automate these processes.
CI/CD Pipeline Architecture
Our CI/CD pipeline follows this workflow:
- Code Push/PR: Triggered when code is pushed or a pull request is opened
- Static Analysis: Code quality checks using Ruff and type checking with Pyright
- Test: Run test suite with pytest
- Build: Create distribution packages
- Deploy (for releases only): Publish to PyPI
Setting Up GitHub Actions
- Create the
.github/workflows
directory in your repository if it doesn't exist - Add the workflow files shown above
- Configure repository secrets for deployment:
- Go to Repository Settings → Secrets → Actions
- Add
PYPI_USERNAME
andPYPI_PASSWORD
secrets
Local Development with CI in Mind
To ensure your changes will pass CI before pushing:
# Install dev dependencies
pip install -e ".[dev]"
# Run linting
ruff check .
ruff format .
# Run type checking
pyright
# Run tests with coverage
pytest --cov=autodoc_ai
Release Process
- Update version in both
pyproject.toml
andsetup.py
- Update
Changelog.md
with the new version and changes - Create and push a tag:
git tag v1.2.3 && git push origin v1.2.3
- Create a new release on GitHub using the tag
- The publish workflow will automatically deploy to PyPI
Troubleshooting CI/CD Issues
Workflow Failures
- Check the specific step that failed in the GitHub Actions interface
- View the logs for detailed error messages
- Reproduce the issue locally if possible
- Common issues:
- Linting failures: Run
ruff check .
locally - Type checking failures: Run
pyright
locally - Test failures: Run
pytest
locally
- Linting failures: Run
Deployment Failures
- Verify your PyPI credentials are correct
- Check for version conflicts (already published versions)
- Ensure your package builds correctly locally with
python -m build
Best Practices
- Always run tests locally before pushing
- Keep workflow files version-controlled and documented
- Use matrix testing for Python version compatibility
- Add detailed comments in workflow files
- Use GitHub environments for deployment protection rules
- Archive artifacts for debugging failed runs