Skip to content

Commit aa20245

Browse files
authored
chore: Add loongsuite distro to release loongsuite (#126)
1 parent 0fa1f9e commit aa20245

File tree

41 files changed

+4919
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4919
-96
lines changed
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
# LoongSuite Release Workflow
2+
#
3+
# This workflow handles the complete LoongSuite release process:
4+
#
5+
# 1. Create release/{version} branch from main
6+
# 2. Build packages (bootstrap_gen.py, PyPI wheels, GitHub Release tar.gz)
7+
# 3. Collect changelogs and archive Unreleased sections
8+
# 4. Commit & push release branch
9+
# 5. Create GitHub Release
10+
# 6. Publish to PyPI / Test PyPI
11+
# 7. Create post-release PR to main (archive changelogs + bump dev versions)
12+
#
13+
# The core logic lives in scripts/loongsuite/loongsuite_release.sh, which can also be
14+
# run locally for the same workflow.
15+
#
16+
# Trigger:
17+
# - workflow_dispatch: Manual trigger with version inputs
18+
# - push tags: Automatic trigger on v* tags
19+
#
20+
# PyPI / Test PyPI configuration:
21+
# - Production PyPI: Set PYPI_API_TOKEN secret, or configure OIDC trusted publishing on pypi.org
22+
# - Test PyPI: Set TEST_PYPI_TOKEN secret (pypi-xxx from https://test.pypi.org/manage/account/token/)
23+
# - Use publish_target: testpypi to publish to Test PyPI instead of production
24+
#
25+
# IMPORTANT: Only loongsuite_util_genai-*.whl and loongsuite_distro-*.whl are uploaded to PyPI.
26+
# loongsuite-python-agent-*.tar.gz is for GitHub Release only and must NOT be uploaded to PyPI.
27+
#
28+
name: LoongSuite Release
29+
30+
run-name: "LoongSuite Release ${{ github.event.inputs.loongsuite_version || github.ref_name }}"
31+
32+
on:
33+
workflow_dispatch:
34+
inputs:
35+
loongsuite_version:
36+
description: 'LoongSuite version (e.g., 0.1.0) - for loongsuite-* packages'
37+
required: true
38+
upstream_version:
39+
description: 'Upstream OTel version (e.g., 0.60b1) - for opentelemetry-* packages in bootstrap_gen.py'
40+
required: true
41+
skip_pypi:
42+
description: 'Skip PyPI publish (for testing)'
43+
type: boolean
44+
default: false
45+
publish_target:
46+
description: 'Publish target: pypi or testpypi'
47+
type: choice
48+
options:
49+
- pypi
50+
- testpypi
51+
default: pypi
52+
push:
53+
tags:
54+
- 'v*'
55+
56+
env:
57+
PYTHON_VERSION: '3.11'
58+
59+
jobs:
60+
# Build all packages, create release branch, archive changelogs
61+
build:
62+
runs-on: ubuntu-latest
63+
permissions:
64+
contents: write
65+
outputs:
66+
loongsuite_version: ${{ steps.version.outputs.loongsuite_version }}
67+
upstream_version: ${{ steps.version.outputs.upstream_version }}
68+
steps:
69+
- uses: actions/checkout@v4
70+
with:
71+
fetch-depth: 0
72+
73+
- name: Set versions from tag or input
74+
id: version
75+
run: |
76+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then
77+
tag="${GITHUB_REF#refs/tags/}"
78+
loongsuite_version="${tag#v}"
79+
upstream_version="${UPSTREAM_VERSION:-0.60b1}"
80+
else
81+
loongsuite_version="${{ github.event.inputs.loongsuite_version }}"
82+
upstream_version="${{ github.event.inputs.upstream_version }}"
83+
fi
84+
85+
if [[ -z "$loongsuite_version" ]]; then
86+
echo "ERROR: loongsuite_version is required"
87+
exit 1
88+
fi
89+
if [[ -z "$upstream_version" ]]; then
90+
echo "ERROR: upstream_version is required"
91+
exit 1
92+
fi
93+
94+
echo "loongsuite_version=$loongsuite_version" >> $GITHUB_OUTPUT
95+
echo "upstream_version=$upstream_version" >> $GITHUB_OUTPUT
96+
97+
echo "LoongSuite version: $loongsuite_version"
98+
echo "Upstream version: $upstream_version"
99+
100+
- uses: actions/setup-python@v5
101+
with:
102+
python-version: ${{ env.PYTHON_VERSION }}
103+
104+
- name: Configure git for CI
105+
run: |
106+
git config user.name "github-actions[bot]"
107+
git config user.email "github-actions[bot]@users.noreply.github.com"
108+
109+
- name: Run release script
110+
run: |
111+
./scripts/loongsuite/loongsuite_release.sh \
112+
--loongsuite-version ${{ steps.version.outputs.loongsuite_version }} \
113+
--upstream-version ${{ steps.version.outputs.upstream_version }} \
114+
--skip-install \
115+
--skip-github-release \
116+
--skip-post-release-pr
117+
118+
- name: Upload PyPI artifacts
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: pypi-packages
122+
path: |
123+
dist-pypi/loongsuite_util_genai-*.whl
124+
dist-pypi/loongsuite_distro-*.whl
125+
126+
- name: Upload GitHub Release artifacts
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: github-release
130+
path: |
131+
dist/loongsuite-python-agent-*.tar.gz
132+
dist/release-notes.md
133+
134+
# Publish to production PyPI
135+
publish-pypi:
136+
needs: build
137+
runs-on: ubuntu-latest
138+
if: |
139+
(github.event_name != 'workflow_dispatch' || !inputs.skip_pypi) &&
140+
(github.event_name != 'workflow_dispatch' || github.event.inputs.publish_target != 'testpypi')
141+
environment:
142+
name: pypi
143+
url: https://pypi.org/project/loongsuite-distro/
144+
permissions:
145+
id-token: write
146+
steps:
147+
- name: Download PyPI artifacts
148+
uses: actions/download-artifact@v4
149+
with:
150+
name: pypi-packages
151+
path: dist/
152+
153+
- name: Publish to PyPI
154+
uses: pypa/gh-action-pypi-publish@release/v1
155+
with:
156+
skip-existing: true
157+
158+
# Publish to Test PyPI (for testing before production)
159+
publish-testpypi:
160+
needs: build
161+
runs-on: ubuntu-latest
162+
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.skip_pypi && inputs.publish_target == 'testpypi' }}
163+
steps:
164+
- name: Download PyPI artifacts
165+
uses: actions/download-artifact@v4
166+
with:
167+
name: pypi-packages
168+
path: dist/
169+
170+
- name: Publish to Test PyPI
171+
uses: pypa/gh-action-pypi-publish@release/v1
172+
with:
173+
repository-url: https://test.pypi.org/legacy/
174+
username: __token__
175+
password: ${{ secrets.TEST_PYPI_TOKEN }}
176+
skip-existing: true
177+
178+
# Create GitHub Release
179+
github-release:
180+
needs: build
181+
runs-on: ubuntu-latest
182+
permissions:
183+
contents: write
184+
steps:
185+
- name: Download GitHub Release artifacts
186+
uses: actions/download-artifact@v4
187+
with:
188+
name: github-release
189+
path: dist/
190+
191+
- name: Create GitHub release
192+
env:
193+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
194+
run: |
195+
VERSION="${{ needs.build.outputs.loongsuite_version }}"
196+
gh release create "v${VERSION}" \
197+
--title "LoongSuite Python Agent v${VERSION}" \
198+
--notes-file dist/release-notes.md \
199+
dist/loongsuite-python-agent-${VERSION}.tar.gz
200+
201+
# Create post-release PR to main (archive changelogs + bump dev versions)
202+
post-release-pr:
203+
needs: build
204+
runs-on: ubuntu-latest
205+
permissions:
206+
contents: write
207+
pull-requests: write
208+
steps:
209+
- uses: actions/checkout@v4
210+
with:
211+
ref: main
212+
fetch-depth: 0
213+
214+
- uses: actions/setup-python@v5
215+
with:
216+
python-version: ${{ env.PYTHON_VERSION }}
217+
218+
- name: Configure git for CI
219+
run: |
220+
git config user.name "github-actions[bot]"
221+
git config user.email "github-actions[bot]@users.noreply.github.com"
222+
223+
- name: Create post-release branch and PR
224+
env:
225+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
226+
run: |
227+
VERSION="${{ needs.build.outputs.loongsuite_version }}"
228+
BRANCH="post-release/v${VERSION}"
229+
TODAY=$(date -u +%Y-%m-%d)
230+
231+
git checkout -b "$BRANCH"
232+
233+
python scripts/loongsuite/collect_loongsuite_changelog.py \
234+
--archive \
235+
--version "$VERSION" \
236+
--date "$TODAY"
237+
238+
python scripts/loongsuite/collect_loongsuite_changelog.py \
239+
--bump-dev \
240+
--version "$VERSION"
241+
242+
git add -A
243+
git commit -m "chore: post-release v${VERSION} - archive changelogs & bump dev versions
244+
245+
- Archive Unreleased changelogs as Version ${VERSION}
246+
- Bump instrumentation-loongsuite module versions to next dev"
247+
248+
git push origin "$BRANCH"
249+
250+
gh pr create \
251+
--base main \
252+
--head "$BRANCH" \
253+
--title "chore: post-release v${VERSION}" \
254+
--body "## Post-release updates for v${VERSION}
255+
256+
- Archive \`Unreleased\` changelog sections as \`Version ${VERSION} (${TODAY})\`
257+
- Bump \`instrumentation-loongsuite\` module versions to next \`.dev\`
258+
259+
This PR was auto-generated by the release workflow."
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Do not edit this file.
2+
# This file is generated automatically by executing tox -e generate-workflows
3+
4+
name: LoongSuite Misc 0
5+
6+
on:
7+
push:
8+
branches-ignore:
9+
- 'release/*'
10+
- 'otelbot/*'
11+
pull_request:
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
env:
21+
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
22+
# For PRs you can change the inner fallback ('main')
23+
# For pushes you change the outer fallback ('main')
24+
# The logic below is used during releases and depends on having an equivalent branch name in the core repo.
25+
CORE_REPO_SHA: ${{ github.event_name == 'pull_request' && (
26+
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
27+
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
28+
'main'
29+
) || 'main' }}
30+
CONTRIB_REPO_SHA: main
31+
PIP_EXISTS_ACTION: w
32+
33+
jobs:
34+
35+
generate-loongsuite:
36+
name: LoongSuite generate-loongsuite
37+
runs-on: ubuntu-latest
38+
timeout-minutes: 30
39+
steps:
40+
- name: Checkout repo @ SHA - ${{ github.sha }}
41+
uses: actions/checkout@v4
42+
43+
- name: Set up Python 3.11
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: "3.11"
47+
48+
- name: Install tox
49+
run: pip install tox-uv
50+
51+
- name: Run tests
52+
run: tox -c tox-loongsuite.ini -e generate-loongsuite
53+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@ pyrightconfig.json
6767

6868
# LoongSuite Extension
6969
.cursor/
70+
dist-*/
7071
upload/
71-
upload_*_test/
72+
upload_*_test/

CHANGELOG-loongsuite.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Fixed
1515

16-
- `loongsuite-instrumentation-google-adk`: Add initial support for Google Agent Development Kit (ADK)
17-
([#71](https://github.com/alibaba/loongsuite-python-agent/pull/71))
18-
19-
- `loongsuite-instrumentation-agno`: fix aresponse missing await and double wrapped() calls in stream methods
20-
([#107](https://github.com/alibaba/loongsuite-python-agent/pull/107))
21-
22-
- `loongsuite-instrumentation-mem0`: fix unittest
23-
([#98](https://github.com/alibaba/loongsuite-python-agent/pull/98))
24-
25-
- `loongsuite-instrumentation-mem0`: use memory handler
26-
([#89](https://github.com/alibaba/loongsuite-python-agent/pull/89))
27-
2816
- Add `from __future__ import annotations` to fix Python 3.9 compatibility for union type syntax (`X | Y`)
2917
([#80](https://github.com/alibaba/loongsuite-python-agent/pull/80))
3018

31-
# Added
19+
### Added
3220

33-
- `loongsuite-instrumentation-mem0`: add hook extension
34-
([#95](https://github.com/alibaba/loongsuite-python-agent/pull/95))
35-
36-
- `loongsuite-instrumentation-mem0`: add support for mem0
37-
([#67](https://github.com/alibaba/loongsuite-python-agent/pull/67))
21+
- `loongsuite-distro`: initialize loongsuite python agent distro
22+
([#126](https://github.com/alibaba/loongsuite-python-agent/pull/126))

0 commit comments

Comments
 (0)