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