|
| 1 | +name: ReleaseV2 (TestPyPI) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + python-version: |
| 7 | + description: "Python version to use" |
| 8 | + default: "3.12" |
| 9 | + required: false |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + id-token: write # required for OIDC publishing to TestPyPI via trusted publisher |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-core: |
| 17 | + name: Build & Test Core SDK |
| 18 | + runs-on: ubuntu-latest |
| 19 | + outputs: |
| 20 | + version: ${{ steps.get_version.outputs.version }} |
| 21 | + steps: |
| 22 | + - name: Checkout repository |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up Python ${{ github.event.inputs.python-version || '3.12' }} |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: ${{ github.event.inputs.python-version || '3.12' }} |
| 29 | + |
| 30 | + - name: Install build tooling (uv & test deps) |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + # Install uv (once) using pip, then use uv for the rest |
| 34 | + python -m pip install uv |
| 35 | + uv pip install pytest pytest-asyncio coverage[toml] |
| 36 | +
|
| 37 | + - name: Sync environment & install dev extras |
| 38 | + run: | |
| 39 | + uv sync --dev --all-packages --all-groups --all-extras |
| 40 | +
|
| 41 | + - name: Build core distributions |
| 42 | + run: | |
| 43 | + uv build -o dist |
| 44 | +
|
| 45 | + - name: Run tests with coverage (core only) |
| 46 | + env: |
| 47 | + PYTHONPATH: "${{ github.workspace }}" |
| 48 | + run: | |
| 49 | + uv run pytest --cov=getstream --cov-report=xml --ignore=getstream/plugins |
| 50 | +
|
| 51 | + - name: Upload coverage artifact |
| 52 | + uses: actions/upload-artifact@v4 |
| 53 | + with: |
| 54 | + name: core-coverage-xml |
| 55 | + path: coverage.xml |
| 56 | + |
| 57 | + - name: Extract package version |
| 58 | + id: get_version |
| 59 | + run: | |
| 60 | + python - <<'PY' |
| 61 | + import tomllib, pathlib, os |
| 62 | + meta = tomllib.loads(pathlib.Path('pyproject.toml').read_text()) |
| 63 | + version = meta['project']['version'] |
| 64 | + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: |
| 65 | + fh.write(f'version={version}\n') |
| 66 | + PY |
| 67 | +
|
| 68 | + - name: Publish core to TestPyPI |
| 69 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 70 | + with: |
| 71 | + repository-url: https://test.pypi.org/legacy/ |
| 72 | + packages-dir: dist |
| 73 | + env: |
| 74 | + name: testpypi |
| 75 | + |
| 76 | + test-core-index: |
| 77 | + name: Verify Core from TestPyPI |
| 78 | + needs: build-core |
| 79 | + runs-on: ubuntu-latest |
| 80 | + env: |
| 81 | + UV_NO_SOURCES: "1" |
| 82 | + steps: |
| 83 | + - name: Set up Python |
| 84 | + uses: actions/setup-python@v5 |
| 85 | + with: |
| 86 | + python-version: ${{ github.event.inputs.python-version || '3.12' }} |
| 87 | + |
| 88 | + - name: Install uv and testing tools |
| 89 | + run: | |
| 90 | + python -m pip install uv |
| 91 | + uv pip install pytest pytest-asyncio |
| 92 | +
|
| 93 | + - name: Install core from TestPyPI using uv |
| 94 | + run: | |
| 95 | + uv pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple getstream==${{ needs.build-core.outputs.version }} |
| 96 | +
|
| 97 | + - name: Run core tests against TestPyPI artifact |
| 98 | + run: | |
| 99 | + UV_NO_SOURCES=1 uv run pytest tests/ --ignore=getstream/plugins |
| 100 | +
|
| 101 | + build-plugins: |
| 102 | + name: Build & Test Plugin Packages |
| 103 | + runs-on: ubuntu-latest |
| 104 | + needs: test-core-index |
| 105 | + env: |
| 106 | + CORE_VERSION: ${{ needs.build-core.outputs.version }} |
| 107 | + UV_NO_SOURCES: "1" |
| 108 | + steps: |
| 109 | + - uses: actions/checkout@v4 |
| 110 | + |
| 111 | + - uses: actions/setup-python@v5 |
| 112 | + with: |
| 113 | + python-version: ${{ github.event.inputs.python-version || '3.12' }} |
| 114 | + |
| 115 | + - name: Install uv & tooling |
| 116 | + run: | |
| 117 | + python -m pip install uv |
| 118 | + uv pip install pytest pytest-asyncio |
| 119 | +
|
| 120 | + - name: Install new core from TestPyPI using uv (for plugin builds/tests) |
| 121 | + run: | |
| 122 | + uv pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple getstream==${CORE_VERSION} |
| 123 | +
|
| 124 | + - name: Build all plugin dists (no workspace sources) |
| 125 | + run: | |
| 126 | + UV_NO_SOURCES=1 uv build --all-packages -o dist-plugins --wheel --sdist |
| 127 | +
|
| 128 | + - name: Run plugin tests (local wheels, core from TestPyPI) |
| 129 | + run: | |
| 130 | + # Install all built plugin wheels using uv |
| 131 | + uv pip install dist-plugins/*.whl |
| 132 | + uv run pytest getstream/plugins |
| 133 | +
|
| 134 | + - name: Publish plugins to TestPyPI |
| 135 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 136 | + with: |
| 137 | + repository-url: https://test.pypi.org/legacy/ |
| 138 | + packages-dir: dist-plugins |
| 139 | + env: |
| 140 | + name: testpypi |
| 141 | + |
| 142 | + test-plugins-index: |
| 143 | + name: Verify Plugins from TestPyPI |
| 144 | + runs-on: ubuntu-latest |
| 145 | + needs: build-plugins |
| 146 | + env: |
| 147 | + CORE_VERSION: ${{ needs.build-core.outputs.version }} |
| 148 | + UV_NO_SOURCES: "1" |
| 149 | + steps: |
| 150 | + - uses: actions/setup-python@v5 |
| 151 | + with: |
| 152 | + python-version: ${{ github.event.inputs.python-version || '3.12' }} |
| 153 | + |
| 154 | + - name: Install uv & test tools |
| 155 | + run: | |
| 156 | + python -m pip install uv |
| 157 | + uv pip install pytest pytest-asyncio |
| 158 | +
|
| 159 | + - name: Install core and plugins from TestPyPI using uv |
| 160 | + run: | |
| 161 | + uv pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple getstream==${CORE_VERSION} |
| 162 | + uv pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple "getstream-plugins-*" |
| 163 | +
|
| 164 | + - name: Run all plugin tests against TestPyPI artifacts |
| 165 | + run: | |
| 166 | + uv run pytest getstream/plugins |
| 167 | +
|
| 168 | + summarize: |
| 169 | + name: Publish Test Deployment Report |
| 170 | + runs-on: ubuntu-latest |
| 171 | + needs: test-plugins-index |
| 172 | + steps: |
| 173 | + - name: Generate summary |
| 174 | + run: | |
| 175 | + echo "### Release V2 Test Report" >> $GITHUB_STEP_SUMMARY |
| 176 | + echo "* Core Version: ${{ needs.build-core.outputs.version }}" >> $GITHUB_STEP_SUMMARY |
| 177 | + echo "* Core build & tests: ✅" >> $GITHUB_STEP_SUMMARY |
| 178 | + echo "* Core published to TestPyPI: ✅" >> $GITHUB_STEP_SUMMARY |
| 179 | + echo "* Plugins built & tests: ✅" >> $GITHUB_STEP_SUMMARY |
| 180 | + echo "* Plugins published to TestPyPI: ✅" >> $GITHUB_STEP_SUMMARY |
| 181 | + echo "* Tests against TestPyPI packages: ✅" >> $GITHUB_STEP_SUMMARY |
0 commit comments