mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-06 10:42:39 +00:00
test action
This commit is contained in:
parent
20f0932cbf
commit
20cfac373b
1 changed files with 166 additions and 164 deletions
330
.github/workflows/publish-to-test-pypi.yml
vendored
330
.github/workflows/publish-to-test-pypi.yml
vendored
|
@ -12,187 +12,187 @@ on:
|
||||||
# - cron: "0 0 * * *" # Run every day at midnight
|
# - cron: "0 0 * * *" # Run every day at midnight
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
trigger-client-and-models-build:
|
# trigger-client-and-models-build:
|
||||||
name: Trigger llama-stack-client and llama-models build
|
# name: Trigger llama-stack-client and llama-models build
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
outputs:
|
# outputs:
|
||||||
version: ${{ steps.version.outputs.version }}
|
# version: ${{ steps.version.outputs.version }}
|
||||||
client_run_id: ${{ steps.trigger-client.outputs.workflow_id }}
|
# client_run_id: ${{ steps.trigger-client.outputs.workflow_id }}
|
||||||
model_run_id: ${{ steps.trigger-models.outputs.workflow_id }}
|
# model_run_id: ${{ steps.trigger-models.outputs.workflow_id }}
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v4
|
# - uses: actions/checkout@v4
|
||||||
with:
|
# with:
|
||||||
persist-credentials: false
|
# persist-credentials: false
|
||||||
- name: Get date
|
# - name: Get date
|
||||||
id: date
|
# id: date
|
||||||
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
|
# run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
|
||||||
- name: Compute version based on dispatch event
|
# - name: Compute version based on dispatch event
|
||||||
id: version
|
# id: version
|
||||||
run: |
|
# run: |
|
||||||
# Read base version from pyproject.toml
|
# # Read base version from pyproject.toml
|
||||||
version=$(sed -n 's/.*version="\([^"]*\)".*/\1/p' setup.py)
|
# version=$(sed -n 's/.*version="\([^"]*\)".*/\1/p' setup.py)
|
||||||
if [ "${{ github.event_name }}" = "schedule" ]; then
|
# if [ "${{ github.event_name }}" = "schedule" ]; then
|
||||||
echo "version=${version}.dev${{ steps.date.outputs.date }}" >> $GITHUB_OUTPUT
|
# echo "version=${version}.dev${{ steps.date.outputs.date }}" >> $GITHUB_OUTPUT
|
||||||
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
# elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
|
# echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
|
||||||
else
|
# else
|
||||||
echo "version=${version}.dev$(shuf -i 10000000-99999999 -n 1)" >> $GITHUB_OUTPUT
|
# echo "version=${version}.dev$(shuf -i 10000000-99999999 -n 1)" >> $GITHUB_OUTPUT
|
||||||
fi
|
# fi
|
||||||
- name: Trigger llama-stack-client workflow
|
# - name: Trigger llama-stack-client workflow
|
||||||
id: trigger-client
|
# id: trigger-client
|
||||||
run: |
|
# run: |
|
||||||
response=$(curl -X POST https://api.github.com/repos/meta-llama/llama-stack-client-python/dispatches \
|
# response=$(curl -X POST https://api.github.com/repos/meta-llama/llama-stack-client-python/dispatches \
|
||||||
-H 'Accept: application/vnd.github.everest-preview+json' \
|
# -H 'Accept: application/vnd.github.everest-preview+json' \
|
||||||
-H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
# -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
||||||
--data "{\"event_type\": \"build-client-package\", \"client_payload\": {\"source\": \"llama-stack-nightly\", \"version\": \"${{ steps.version.outputs.version }}\"}}" \
|
# --data "{\"event_type\": \"build-client-package\", \"client_payload\": {\"source\": \"llama-stack-nightly\", \"version\": \"${{ steps.version.outputs.version }}\"}}" \
|
||||||
-w "\n%{http_code}")
|
# -w "\n%{http_code}")
|
||||||
|
|
||||||
http_code=$(echo "$response" | tail -n1)
|
# http_code=$(echo "$response" | tail -n1)
|
||||||
if [ "$http_code" != "204" ]; then
|
# if [ "$http_code" != "204" ]; then
|
||||||
echo "Failed to trigger client workflow"
|
# echo "Failed to trigger client workflow"
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Get the run ID of the triggered workflow
|
# # Get the run ID of the triggered workflow
|
||||||
sleep 5 # Wait for workflow to be created
|
# sleep 5 # Wait for workflow to be created
|
||||||
run_id=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
# run_id=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
||||||
"https://api.github.com/repos/meta-llama/llama-stack-client-python/actions/runs?event=repository_dispatch" \
|
# "https://api.github.com/repos/meta-llama/llama-stack-client-python/actions/runs?event=repository_dispatch" \
|
||||||
| jq '.workflow_runs[0].id')
|
# | jq '.workflow_runs[0].id')
|
||||||
echo "workflow_id=$run_id" >> $GITHUB_OUTPUT
|
# echo "workflow_id=$run_id" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Trigger llama-models workflow
|
# - name: Trigger llama-models workflow
|
||||||
id: trigger-models
|
# id: trigger-models
|
||||||
run: |
|
# run: |
|
||||||
response=$(curl -X POST https://api.github.com/repos/meta-llama/llama-models/dispatches \
|
# response=$(curl -X POST https://api.github.com/repos/meta-llama/llama-models/dispatches \
|
||||||
-H 'Accept: application/vnd.github.everest-preview+json' \
|
# -H 'Accept: application/vnd.github.everest-preview+json' \
|
||||||
-H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
# -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
||||||
--data "{\"event_type\": \"build-models-package\", \"client_payload\": {\"source\": \"llama-stack-nightly\", \"version\": \"${{ steps.version.outputs.version }}\"}}" \
|
# --data "{\"event_type\": \"build-models-package\", \"client_payload\": {\"source\": \"llama-stack-nightly\", \"version\": \"${{ steps.version.outputs.version }}\"}}" \
|
||||||
-w "\n%{http_code}")
|
# -w "\n%{http_code}")
|
||||||
|
|
||||||
http_code=$(echo "$response" | tail -n1)
|
# http_code=$(echo "$response" | tail -n1)
|
||||||
if [ "$http_code" != "204" ]; then
|
# if [ "$http_code" != "204" ]; then
|
||||||
echo "Failed to trigger models workflow"
|
# echo "Failed to trigger models workflow"
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Get the run ID of the triggered workflow
|
# # Get the run ID of the triggered workflow
|
||||||
sleep 5 # Wait for workflow to be created
|
# sleep 5 # Wait for workflow to be created
|
||||||
run_id=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
# run_id=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
||||||
"https://api.github.com/repos/meta-llama/llama-models/actions/runs?event=repository_dispatch" \
|
# "https://api.github.com/repos/meta-llama/llama-models/actions/runs?event=repository_dispatch" \
|
||||||
| jq '.workflow_runs[0].id')
|
# | jq '.workflow_runs[0].id')
|
||||||
echo "workflow_id=$run_id" >> $GITHUB_OUTPUT
|
# echo "workflow_id=$run_id" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
wait-for-workflows:
|
# wait-for-workflows:
|
||||||
name: Wait for triggered workflows
|
# name: Wait for triggered workflows
|
||||||
needs: trigger-client-and-models-build
|
# needs: trigger-client-and-models-build
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
steps:
|
# steps:
|
||||||
- name: Wait for client workflow
|
# - name: Wait for client workflow
|
||||||
run: |
|
# run: |
|
||||||
while true; do
|
# while true; do
|
||||||
status=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
# status=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
||||||
"https://api.github.com/repos/meta-llama/llama-stack-client-python/actions/runs/${{ needs.trigger-client-and-models-build.outputs.client_run_id }}" \
|
# "https://api.github.com/repos/meta-llama/llama-stack-client-python/actions/runs/${{ needs.trigger-client-and-models-build.outputs.client_run_id }}" \
|
||||||
| jq -r '.status')
|
# | jq -r '.status')
|
||||||
conclusion=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
# conclusion=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
||||||
"https://api.github.com/repos/meta-llama/llama-stack-client-python/actions/runs/${{ needs.trigger-client-and-models-build.outputs.client_run_id }}" \
|
# "https://api.github.com/repos/meta-llama/llama-stack-client-python/actions/runs/${{ needs.trigger-client-and-models-build.outputs.client_run_id }}" \
|
||||||
| jq -r '.conclusion')
|
# | jq -r '.conclusion')
|
||||||
|
|
||||||
echo "llama-stack-client-python workflow status: $status, conclusion: $conclusion"
|
# echo "llama-stack-client-python workflow status: $status, conclusion: $conclusion"
|
||||||
|
|
||||||
if [ "$status" = "completed" ]; then
|
# if [ "$status" = "completed" ]; then
|
||||||
if [ "$conclusion" != "success" ]; then
|
# if [ "$conclusion" != "success" ]; then
|
||||||
echo "llama-stack-client-python workflow failed"
|
# echo "llama-stack-client-python workflow failed"
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
break
|
# break
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
sleep 10
|
# sleep 10
|
||||||
done
|
# done
|
||||||
|
|
||||||
- name: Wait for models workflow
|
# - name: Wait for models workflow
|
||||||
run: |
|
# run: |
|
||||||
while true; do
|
# while true; do
|
||||||
status=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
# status=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
||||||
"https://api.github.com/repos/meta-llama/llama-models/actions/runs/${{ needs.trigger-client-and-models-build.outputs.model_run_id }}" \
|
# "https://api.github.com/repos/meta-llama/llama-models/actions/runs/${{ needs.trigger-client-and-models-build.outputs.model_run_id }}" \
|
||||||
| jq -r '.status')
|
# | jq -r '.status')
|
||||||
conclusion=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
# conclusion=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
|
||||||
"https://api.github.com/repos/meta-llama/llama-models/actions/runs/${{ needs.trigger-client-and-models-build.outputs.model_run_id }}" \
|
# "https://api.github.com/repos/meta-llama/llama-models/actions/runs/${{ needs.trigger-client-and-models-build.outputs.model_run_id }}" \
|
||||||
| jq -r '.conclusion')
|
# | jq -r '.conclusion')
|
||||||
|
|
||||||
echo "llama-models workflow status: $status, conclusion: $conclusion"
|
# echo "llama-models workflow status: $status, conclusion: $conclusion"
|
||||||
|
|
||||||
if [ "$status" = "completed" ]; then
|
# if [ "$status" = "completed" ]; then
|
||||||
if [ "$conclusion" != "success" ]; then
|
# if [ "$conclusion" != "success" ]; then
|
||||||
echo "llama-models workflow failed"
|
# echo "llama-models workflow failed"
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
break
|
# break
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
sleep 10
|
# sleep 10
|
||||||
done
|
# done
|
||||||
|
|
||||||
build:
|
# build:
|
||||||
name: Build distribution 📦
|
# name: Build distribution 📦
|
||||||
needs:
|
# needs:
|
||||||
- wait-for-workflows
|
# - wait-for-workflows
|
||||||
- trigger-client-and-models-build
|
# - trigger-client-and-models-build
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v4
|
# - uses: actions/checkout@v4
|
||||||
with:
|
# with:
|
||||||
persist-credentials: false
|
# persist-credentials: false
|
||||||
- name: Get date
|
# - name: Get date
|
||||||
id: date
|
# id: date
|
||||||
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
|
# run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
|
||||||
- name: Update version for nightly
|
# - name: Update version for nightly
|
||||||
run: |
|
# run: |
|
||||||
sed -i 's/version="\([^"]*\)"/version="${{ needs.trigger-client-and-models-build.outputs.version }}"/' setup.py
|
# 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-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
|
# sed -i 's/llama-models>=\([^"]*\)/llama-models==${{ needs.trigger-client-and-models-build.outputs.version }}/' requirements.txt
|
||||||
- name: Set up Python
|
# - name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
# uses: actions/setup-python@v5
|
||||||
with:
|
# with:
|
||||||
python-version: "3.11"
|
# python-version: "3.11"
|
||||||
- name: Install pypa/build
|
# - name: Install pypa/build
|
||||||
run: >-
|
# run: >-
|
||||||
python3 -m
|
# python3 -m
|
||||||
pip install
|
# pip install
|
||||||
build
|
# build
|
||||||
--user
|
# --user
|
||||||
- name: Build a binary wheel and a source tarball
|
# - name: Build a binary wheel and a source tarball
|
||||||
run: python3 -m build
|
# run: python3 -m build
|
||||||
- name: Store the distribution packages
|
# - name: Store the distribution packages
|
||||||
uses: actions/upload-artifact@v4
|
# uses: actions/upload-artifact@v4
|
||||||
with:
|
# with:
|
||||||
name: python-package-distributions
|
# name: python-package-distributions
|
||||||
path: dist/
|
# path: dist/
|
||||||
|
|
||||||
publish-to-testpypi:
|
# publish-to-testpypi:
|
||||||
name: Publish Python 🐍 distribution 📦 to TestPyPI
|
# name: Publish Python 🐍 distribution 📦 to TestPyPI
|
||||||
needs:
|
# needs:
|
||||||
- build
|
# - build
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
|
|
||||||
environment:
|
# environment:
|
||||||
name: testrelease
|
# name: testrelease
|
||||||
url: https://test.pypi.org/p/llama-stack
|
# url: https://test.pypi.org/p/llama-stack
|
||||||
|
|
||||||
permissions:
|
# permissions:
|
||||||
id-token: write # IMPORTANT: mandatory for trusted publishing
|
# id-token: write # IMPORTANT: mandatory for trusted publishing
|
||||||
|
|
||||||
steps:
|
# steps:
|
||||||
- name: Download all the dists
|
# - name: Download all the dists
|
||||||
uses: actions/download-artifact@v4
|
# uses: actions/download-artifact@v4
|
||||||
with:
|
# with:
|
||||||
name: python-package-distributions
|
# name: python-package-distributions
|
||||||
path: dist/
|
# path: dist/
|
||||||
- name: Publish distribution 📦 to TestPyPI
|
# - name: Publish distribution 📦 to TestPyPI
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
# uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
# with:
|
||||||
repository-url: https://test.pypi.org/legacy/
|
# repository-url: https://test.pypi.org/legacy/
|
||||||
|
|
||||||
test-published-package:
|
test-published-package:
|
||||||
name: Test published package
|
name: Test published package
|
||||||
|
@ -207,7 +207,7 @@ jobs:
|
||||||
attempt=1
|
attempt=1
|
||||||
while [ $attempt -le $max_attempts ]; do
|
while [ $attempt -le $max_attempts ]; do
|
||||||
echo "Attempt $attempt of $max_attempts to install package..."
|
echo "Attempt $attempt of $max_attempts to install package..."
|
||||||
if pip install --no-cache --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ llama-stack==${{ needs.trigger-client-and-models-build.outputs.version }}; then
|
if pip install --no-cache --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ llama-stack==0.0.63.dev86738855; then
|
||||||
echo "Package installed successfully"
|
echo "Package installed successfully"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -232,7 +232,9 @@ jobs:
|
||||||
- name: Test Notebook
|
- name: Test Notebook
|
||||||
run: |
|
run: |
|
||||||
pip install pytest nbval
|
pip install pytest nbval
|
||||||
pytest -v -s --nbval-lax docs/notebooks/Llama_Stack_Building_AI_Applications.ipynb
|
pwd
|
||||||
|
ls
|
||||||
|
pytest -v -s --nbval-lax ./docs/notebooks/Llama_Stack_Building_AI_Applications.ipynb
|
||||||
|
|
||||||
|
|
||||||
# TODO: add trigger for integration test workflow & docker builds
|
# TODO: add trigger for integration test workflow & docker builds
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue