|
| 1 | +# GitHub Actions Workflows for YarnGPT SDK |
| 2 | + |
| 3 | +This directory contains GitHub Actions workflows for automated testing, linting, and publishing. |
| 4 | + |
| 5 | +## Workflows |
| 6 | + |
| 7 | +### 1. **test.yml** - Automated Testing |
| 8 | + |
| 9 | +- **Trigger:** Push/PR to main, master, or develop branches |
| 10 | +- **What it does:** |
| 11 | + - Tests on Ubuntu, Windows, and macOS |
| 12 | + - Tests Python 3.8, 3.9, 3.10, 3.11, and 3.12 |
| 13 | + - Runs unit tests (skips integration tests that need API key) |
| 14 | + - Validates package can be built |
| 15 | +- **No secrets required** ✓ |
| 16 | + |
| 17 | +### 2. **lint.yml** - Code Quality Checks |
| 18 | + |
| 19 | +- **Trigger:** Push/PR to main, master, or develop branches |
| 20 | +- **What it does:** |
| 21 | + - Runs ruff linting |
| 22 | + - Checks code formatting |
| 23 | + - Runs mypy type checking |
| 24 | +- **No secrets required** ✓ |
| 25 | + |
| 26 | +### 3. **publish-test.yml** - Publish to TestPyPI |
| 27 | + |
| 28 | +- **Trigger:** Push to develop branch or manual trigger |
| 29 | +- **What it does:** |
| 30 | + - Runs tests |
| 31 | + - Builds package |
| 32 | + - Publishes to TestPyPI for testing |
| 33 | +- **Requires:** `TEST_PYPI_API_TOKEN` secret |
| 34 | + |
| 35 | +### 4. **publish.yml** - Publish to PyPI |
| 36 | + |
| 37 | +- **Trigger:** When you create a GitHub release or manual trigger |
| 38 | +- **What it does:** |
| 39 | + - Runs tests |
| 40 | + - Builds package with uv |
| 41 | + - Publishes to PyPI |
| 42 | +- **Requires:** `PYPI_API_TOKEN` secret |
| 43 | + |
| 44 | +## Setup Instructions |
| 45 | + |
| 46 | +### For Testing and Linting (No secrets needed!) |
| 47 | + |
| 48 | +These workflows work automatically once you push to GitHub. No configuration required. |
| 49 | + |
| 50 | +### For Publishing to PyPI |
| 51 | + |
| 52 | +#### 1. Get PyPI API Token |
| 53 | + |
| 54 | +1. Create account on [PyPI](https://pypi.org) |
| 55 | +2. Go to Account Settings → API tokens |
| 56 | +3. Create a new API token with scope for this project |
| 57 | +4. Copy the token (starts with `pyp-...`) |
| 58 | + |
| 59 | +#### 2. Add Secret to GitHub |
| 60 | + |
| 61 | +1. Go to your repository on GitHub |
| 62 | +2. Settings → Secrets and variables → Actions |
| 63 | +3. Click "New repository secret" |
| 64 | +4. Name: `PYPI_API_TOKEN` |
| 65 | +5. Value: Paste your PyPI token |
| 66 | +6. Click "Add secret" |
| 67 | + |
| 68 | +#### 3. (Optional) Setup TestPyPI |
| 69 | + |
| 70 | +For testing releases before publishing to real PyPI: |
| 71 | + |
| 72 | +1. Create account on [TestPyPI](https://test.pypi.org) |
| 73 | +2. Get API token from TestPyPI |
| 74 | +3. Add as `TEST_PYPI_API_TOKEN` secret in GitHub |
| 75 | + |
| 76 | +## Publishing Process |
| 77 | + |
| 78 | +### Test Release (to TestPyPI) |
| 79 | + |
| 80 | +```bash |
| 81 | +# Push to develop branch |
| 82 | +git push origin develop |
| 83 | +``` |
| 84 | + |
| 85 | +Or trigger manually in GitHub Actions tab |
| 86 | + |
| 87 | +### Production Release (to PyPI) |
| 88 | + |
| 89 | +1. Update version in `pyproject.toml` |
| 90 | +2. Commit and push changes |
| 91 | +3. Create a GitHub release: |
| 92 | + |
| 93 | + ```bash |
| 94 | + git tag v0.1.0 |
| 95 | + git push origin v0.1.0 |
| 96 | + ``` |
| 97 | + |
| 98 | +4. Go to GitHub → Releases → Create new release |
| 99 | +5. Select the tag, add release notes |
| 100 | +6. Publish release |
| 101 | +7. GitHub Actions will automatically build and publish to PyPI! |
| 102 | + |
| 103 | +### Manual Publish |
| 104 | + |
| 105 | +You can also trigger publishing manually: |
| 106 | + |
| 107 | +1. Go to Actions tab in GitHub |
| 108 | +2. Select "Publish to PyPI" workflow |
| 109 | +3. Click "Run workflow" |
| 110 | + |
| 111 | +## Building Locally with uv |
| 112 | + |
| 113 | +```bash |
| 114 | +# Build the package |
| 115 | +uv build |
| 116 | + |
| 117 | +# Check the built package |
| 118 | +ls dist/ |
| 119 | + |
| 120 | +# Test install locally |
| 121 | +uv pip install dist/yarngpt_sdk-0.1.0-py3-none-any.whl |
| 122 | + |
| 123 | +# Publish manually (if needed) |
| 124 | +uv publish |
| 125 | +``` |
| 126 | + |
| 127 | +## Workflow Status Badges |
| 128 | + |
| 129 | +Add these to your README.md: |
| 130 | + |
| 131 | +```markdown |
| 132 | +[](https://github.com/hallelx2/yarngpt-sdk/actions/workflows/test.yml) |
| 133 | +[](https://github.com/hallelx2/yarngpt-sdk/actions/workflows/lint.yml) |
| 134 | +``` |
0 commit comments