-
Notifications
You must be signed in to change notification settings - Fork 804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CICD] github workflow to push nightly package to testpypi #734
Merged
Merged
Changes from 53 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
bc27343
test workflow
yanxi0830 074d856
test
yanxi0830 665c088
on workflow dispatch
yanxi0830 efb14c1
cleanup setup
yanxi0830 94d619b
nightly
yanxi0830 87e2cb8
test
yanxi0830 e855291
test
yanxi0830 c7becda
test
yanxi0830 a6e1740
test 0.0.64
yanxi0830 8ffdff1
rc?
yanxi0830 8640a30
rc?
yanxi0830 10b1360
remove hash
yanxi0830 3ce9601
nightly
yanxi0830 6c3b9fa
back to rc
yanxi0830 a45ce85
change schedule
yanxi0830 b8df87b
Add automatic PyPI release GitHub workflow (#618)
terrytangyuan 45cf46e
rebase
yanxi0830 20dc186
test
yanxi0830 8527b79
test
yanxi0830 6202503
initial test
yanxi0830 16af87c
test trigger
yanxi0830 7ca2f5e
llama-stack-client-python
yanxi0830 ccd3ec1
test
yanxi0830 1988713
update requirements
yanxi0830 2644e09
bugfix
yanxi0830 df55ec6
fix
yanxi0830 0b0446f
fix
yanxi0830 d8c9798
test
yanxi0830 63232d7
remove double quotes
yanxi0830 cca2781
fix versions
yanxi0830 dc74675
add ver
yanxi0830 4387863
final workflow
yanxi0830 5f051b2
final workflow
yanxi0830 2847d70
remove dispatch on push
yanxi0830 1ea4666
add back requirements
yanxi0830 97d31d7
add back requirements
yanxi0830 7cdd8b9
trigger models build
yanxi0830 650016f
trigger models build
yanxi0830 7e57441
bugfix
yanxi0830 cbc2886
bugfix and add requirements
yanxi0830 c02b706
add back workflow dispatch
yanxi0830 dc9148b
replace w/ curl
yanxi0830 697df3e
tested, back to workflow_dispatch/schedule
yanxi0830 d9f14e2
instead of prefix, use full version
yanxi0830 0f7016a
instead of prefix, use full version
yanxi0830 de3161f
bugfix
yanxi0830 3df88b8
manual trigger
yanxi0830 cf673be
revert back
yanxi0830 74babf8
revert back
yanxi0830 f9c309d
Merge branch 'main' into testpypi-workflow
yanxi0830 5f04869
rebase & trigger a push
yanxi0830 58ed2d2
revert back
yanxi0830 74c6c9e
test simple cli
yanxi0830 0086734
test done
yanxi0830 5b8b809
test wait
yanxi0830 8366230
test wait
yanxi0830 00fa4ca
test wait
yanxi0830 6aaab0d
scheduled run
yanxi0830 9baedf6
better msg
yanxi0830 07bbfad
temp check
yanxi0830 285d8e1
back to prod
yanxi0830 99c7352
more robust workflow id
yanxi0830 040c643
back to prod
yanxi0830 ee80853
back to prod
yanxi0830 27be071
last test
yanxi0830 bef7e5b
prod
yanxi0830 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: Publish Python 🐍 distribution 📦 to TestPyPI | ||
|
||
on: | ||
push | ||
# workflow_dispatch: # Keep manual trigger | ||
# inputs: | ||
# version: | ||
# description: 'Version number (e.g. 0.0.63.dev20250111)' | ||
# required: true | ||
# type: string | ||
# schedule: | ||
# - cron: "0 0 * * *" # Run every day at midnight | ||
|
||
jobs: | ||
trigger-client-and-models-build: | ||
name: Trigger llama-stack-client and llama-models build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Get date | ||
id: date | ||
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | ||
- name: Compute version based on dispatch event | ||
id: version | ||
run: | | ||
# Read base version from pyproject.toml | ||
version=$(sed -n 's/.*version="\([^"]*\)".*/\1/p' setup.py) | ||
if [ "${{ github.event_name }}" = "schedule" ]; then | ||
echo "version=${version}.dev${{ steps.date.outputs.date }}" >> $GITHUB_OUTPUT | ||
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT | ||
else | ||
echo "version=${version}.dev$(shuf -i 10000000-99999999 -n 1)" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Trigger llama-stack-client workflow | ||
run: | | ||
curl -X POST https://api.github.com/repos/meta-llama/llama-stack-client-python/dispatches \ | ||
-H 'Accept: application/vnd.github.everest-preview+json' \ | ||
-H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \ | ||
--data "{\"event_type\": \"build-client-package\", \"client_payload\": {\"source\": \"llama-stack-nightly\", \"version\": \"${{ steps.version.outputs.version }}\"}}" | ||
- name: Trigger llama-models workflow | ||
run: | | ||
curl -X POST https://api.github.com/repos/meta-llama/llama-models/dispatches \ | ||
-H 'Accept: application/vnd.github.everest-preview+json' \ | ||
-H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \ | ||
--data "{\"event_type\": \"build-models-package\", \"client_payload\": {\"source\": \"llama-stack-nightly\", \"version\": \"${{ steps.version.outputs.version }}\"}}" | ||
outputs: | ||
version: ${{ steps.version.outputs.version }} | ||
|
||
build: | ||
name: Build distribution 📦 | ||
needs: trigger-client-and-models-build # Wait for client build to complete | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Get date | ||
id: date | ||
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | ||
- name: Update version for nightly | ||
run: | | ||
sed -i 's/version="\([^"]*\)"/version="${{ needs.trigger-client-and-models-build.outputs.version }}"/' setup.py | ||
sed -i 's/llama-stack-client>=\([^"]*\)/llama-stack-client==${{ needs.trigger-client-and-models-build.outputs.version }}/' requirements.txt | ||
sed -i 's/llama-models>=\([^"]*\)/llama-models==${{ needs.trigger-client-and-models-build.outputs.version }}/' requirements.txt | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Install pypa/build | ||
run: >- | ||
python3 -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: python3 -m build | ||
yanxi0830 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-testpypi: | ||
name: Publish Python 🐍 distribution 📦 to TestPyPI | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: testrelease | ||
url: https://test.pypi.org/p/llama-stack | ||
|
||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution 📦 to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
test-published-package: | ||
name: Test published package | ||
needs: | ||
- publish-to-testpypi | ||
- trigger-client-and-models-build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install the package | ||
run: | | ||
sleep 10 | ||
pip install --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ llama-stack==${{ needs.trigger-client-and-models-build.outputs.version }} | ||
- name: Test the package versions | ||
run: | | ||
pip list | grep llama_ | ||
- name: Test CLI commands | ||
run: | | ||
llama model list | ||
llama stack build --list-templates | ||
llama model prompt-format -m Llama3.2-11B-Vision-Instruct | ||
llama stack list-apis | ||
llama stack list-providers inference | ||
llama stack list-providers telemetry | ||
|
||
# TODO: add trigger for integration test workflow & docker builds | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @sixianyi0721 we can add a step to trigger integration test flow here using the built package |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this case happens when you run the workflow adhoc by pressing a button from the UI, for example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this case only happens with testing (e.g. on push). If you press the button, you will need to enter the version: