Skip to content

Deployment Guide

This guide covers all deployment processes for the ReZEN Python client, consolidated into GitHub Actions workflows.

๐Ÿš€ Quick Overview

All deployments are handled automatically through GitHub Actions:

  • Code Quality: Automatic on every push/PR
  • Testing: Automatic on every push/PR
  • Documentation: Automatic on docs changes
  • Releases: Manual trigger or tag-based

๐Ÿ“‹ Prerequisites

GitHub Secrets

Ensure these secrets are configured in your repository:

# Required for all deployments
REZEN_API_KEY                 # For running tests
GITHUB_TOKEN                  # Auto-provided

# Required for PyPI publishing
PYPI_API_TOKEN               # PyPI API token

๐Ÿ”„ Automated Workflows

1. Continuous Integration (ci.yml)

Triggers: Every push/PR to main or develop

What it does: - โœ… Code quality checks (Black, isort, flake8, mypy) - ๐Ÿ”’ Security scanning (Bandit, Safety) - ๐Ÿ“ Config validation (YAML, TOML) - ๐Ÿงช Test suite across Python 3.8-3.12 - ๐Ÿ“ฆ Package build verification

2. Documentation (docs.yml)

Triggers: Changes to docs/, mkdocs.yml, or code

What it does: - ๐Ÿ”„ Auto-sync API coverage - ๐Ÿ“š Build documentation with MkDocs - ๐Ÿš€ Deploy to GitHub Pages - ๐Ÿ’ฌ PR comments with build status

3. Release (release.yml)

Triggers: - Tag push (v*) - Manual workflow dispatch

What it does: - ๐Ÿท๏ธ Version bumping (manual releases) - โœ… Full test suite - ๐Ÿ“ฆ Package building
- ๐Ÿš€ PyPI publishing - ๐Ÿ“‹ GitHub release creation - ๐Ÿ“ Automatic changelog generation

๐Ÿ› ๏ธ Manual Operations

Creating a Release

  1. Go to Actions โ†’ Release โ†’ Run workflow
  2. Enter version (e.g., 1.2.3)
  3. Optionally mark as prerelease
  4. Click Run workflow

The workflow will: - Validate version format - Update pyproject.toml and rezen/__init__.py - Create and push the git tag - Run tests and build - Publish to PyPI - Create GitHub release

Option 2: Tag-based Release

# Update versions manually
vim pyproject.toml      # Update version = "1.2.3"
vim rezen/__init__.py   # Update __version__ = "1.2.3"

# Commit and tag
git add pyproject.toml rezen/__init__.py
git commit -m "Bump version to 1.2.3"
git tag -a v1.2.3 -m "Release v1.2.3"
git push origin main --tags

Local Development

Documentation

# Install dependencies
pip install -r docs/requirements.txt

# Serve locally  
mkdocs serve

# Build for testing
mkdocs build

Testing

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest --cov=rezen

# Run quality checks
black --check .
isort --check .
flake8 .
mypy rezen/

๐Ÿ”ง Configuration Files

Minimal Configuration

The following files are no longer needed and have been consolidated into GitHub Actions:

  • โŒ .pre-commit-config.yaml โ†’ Integrated into CI workflow
  • โŒ scripts/bump_version.py โ†’ Integrated into release workflow
  • โŒ scripts/sync_docs.py โ†’ Integrated into docs workflow
  • โš ๏ธ .readthedocs.yml โ†’ Optional (if using RTD alongside GitHub Pages)

Required Files

  • โœ… .github/workflows/ โ†’ All automation
  • โœ… mkdocs.yml โ†’ Documentation config
  • โœ… pyproject.toml โ†’ Package config
  • โœ… requirements.txt & requirements-dev.txt โ†’ Dependencies

๐Ÿšจ Troubleshooting

Release Issues

Version mismatch errors:

# Check current versions
grep version pyproject.toml
grep __version__ rezen/__init__.py

# Ensure they match your intended version

PyPI publishing fails: - Verify PYPI_API_TOKEN secret is set - Check if version already exists on PyPI - Ensure package builds successfully

Documentation Issues

Build failures: - Check MkDocs configuration in mkdocs.yml - Verify all referenced files exist - Check for syntax errors in markdown

CI Issues

Code quality failures:

# Fix formatting
black .
isort .

# Check for issues
flake8 .
mypy rezen/

Test failures: - Ensure REZEN_API_KEY is set in secrets - Check for environment-specific issues - Verify all dependencies are installed

๐Ÿ“Š Monitoring

Workflow Status

Monitor deployments at: - GitHub Actions: Repository โ†’ Actions tab - PyPI: https://pypi.org/project/rezen/ - GitHub Pages: https://theperrygroup.github.io/rezen/

Coverage Reports

  • Codecov: Automatic uploads from CI
  • Security: Bandit reports in CI artifacts
  • Dependencies: Dependabot PRs for updates

๐ŸŽฏ Best Practices

  1. Always test locally before pushing
  2. Use manual releases for better control
  3. Write descriptive commit messages for better changelogs
  4. Keep dependencies updated via Dependabot
  5. Monitor workflow runs for issues
  6. Use semantic versioning (e.g., 1.2.3)

๐Ÿ“ž Support

If workflows fail or you need help:

  1. Check workflow logs in GitHub Actions
  2. Review this guide for common issues
  3. Check repository Issues for known problems
  4. Create a new issue with workflow logs attached