Skip to content

[Q1-P0] Create pre-release validation checklist and automation #22

@karlwaldman

Description

@karlwaldman

Problem

Current release process:

  1. Run unit tests ✅
  2. Publish to PyPI ✅
  3. Hope nothing breaks ❌

Result: Bugs reach production

Solution

Automated pre-release validation that MUST pass before PyPI publish:

#!/bin/bash
# scripts/pre_release_validation.sh

set -e

echo "Pre-Release Validation for SDK v${VERSION}"
echo "========================================"

# 1. Unit tests
echo "Running unit tests..."
pytest tests/unit/ -v || exit 1

# 2. Integration tests
echo "Running integration tests against production API..."
pytest tests/integration/ --integration -v || exit 1

# 3. Performance tests
echo "Running performance benchmarks..."
pytest tests/performance/ --performance -v || exit 1

# 4. Endpoint validation
echo "Validating all endpoints exist..."
python scripts/validate_endpoints.py || exit 1

# 5. Build test
echo "Building package..."
python -m build || exit 1

# 6. Install and smoke test
echo "Installing built package..."
pip install dist/*.whl
python -c "import oilpriceapi; print(oilpriceapi.__version__)" || exit 1

echo ""
echo "✅ All validation checks passed"
echo "Ready to publish to PyPI"

Pre-Release Checklist

Code Quality

  • All unit tests pass
  • All integration tests pass
  • All performance tests pass
  • Code coverage >80%
  • No linting errors
  • No type errors (mypy)

Integration Validation

  • Test against production API
  • All endpoints return expected responses
  • Response times within expected ranges:
    • 1 day query: <5s
    • 1 week query: <15s
    • 1 month query: <30s
    • 1 year query: <90s
  • Timeout handling works correctly
  • Error handling works correctly

Documentation

  • CHANGELOG.md updated
  • Version bumped in all locations
  • README.md updated if needed
  • Migration guide if breaking changes
  • Examples tested and working

Package Build

  • Package builds successfully
  • Wheel installs cleanly
  • Import works after install
  • Version matches expected

Post-Release Monitoring (24h)

  • PyPI package available
  • Installation works: pip install oilpriceapi
  • Monitor error rates
  • Check download stats
  • Monitor support tickets

Automation

# .github/workflows/pre-release.yml

name: Pre-Release Validation

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version to release'
        required: true

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Run pre-release validation
        env:
          TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
        run: |
          chmod +x scripts/pre_release_validation.sh
          ./scripts/pre_release_validation.sh

      - name: Create release checklist issue
        if: success()
        run: |
          gh issue create \
            --title "Release v${{ github.event.inputs.version }} - Complete Checklist" \
            --body-file .github/release_checklist_template.md \
            --label "release"

Acceptance Criteria

  • Pre-release script created and tested
  • Script runs all validation checks
  • Script fails fast on any check failure
  • GitHub workflow created
  • Release checklist template created
  • Documentation updated with release process

Estimated Effort

Time: 2 hours
Complexity: Low

Success Metrics

  • Zero releases with P0 bugs
  • All releases pass validation before publish
  • Release process takes <30 minutes total

Usage

# Before publishing to PyPI
./scripts/pre_release_validation.sh

# If all checks pass
twine upload dist/*

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationAutomation improvementspriority: criticalMust be fixed immediatelyquadrant: q1Urgent & Important (Do First)type: processProcess and workflow improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions