From 1bb74d95ad21eb978ffdc3f8fa66688a28815190 Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Sun, 2 Feb 2025 10:21:57 -0800 Subject: [PATCH] Delete CI workflows from here since they have moved to llama-stack-ops --- .github/workflows/publish-to-docker.yml | 148 ------------- .github/workflows/publish-to-test-pypi.yml | 244 --------------------- 2 files changed, 392 deletions(-) delete mode 100644 .github/workflows/publish-to-docker.yml delete mode 100644 .github/workflows/publish-to-test-pypi.yml diff --git a/.github/workflows/publish-to-docker.yml b/.github/workflows/publish-to-docker.yml deleted file mode 100644 index 0dbca6939..000000000 --- a/.github/workflows/publish-to-docker.yml +++ /dev/null @@ -1,148 +0,0 @@ -name: Docker Build and Publish - -on: - workflow_dispatch: - inputs: - version: - description: 'TestPyPI or PyPI version to build (e.g., 0.0.63.dev20250114)' - required: true - type: string - -jobs: - build-and-push: - runs-on: ubuntu-latest - env: - TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }} - FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }} - TAVILY_SEARCH_API_KEY: ${{ secrets.TAVILY_SEARCH_API_KEY }} - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set version - id: version - run: | - if [ "${{ github.event_name }}" = "push" ]; then - echo "VERSION=0.0.63.dev51206766" >> $GITHUB_OUTPUT - else - echo "VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT - fi - - - name: Check package version availability - run: | - # Function to check if version exists in a repository - check_version() { - local repo=$1 - local VERSION_TO_CHECK=${{ steps.version.outputs.version }} - echo "Checking version $VERSION_TO_CHECK in $repo" - result=$(curl -s "https://$repo.org/pypi/llama-stack/json" | jq --arg v "$VERSION_TO_CHECK" '.releases | has($v)') - echo "Result: $result" - return $([ "$result" = "true" ]) - } - - # Check TestPyPI first, then PyPI - if check_version "test.pypi"; then - echo "Version ${{ steps.version.outputs.version }} found in TestPyPI" - echo "PYPI_SOURCE=testpypi" >> $GITHUB_ENV - elif check_version "pypi"; then - echo "Version ${{ steps.version.outputs.version }} found in PyPI" - echo "PYPI_SOURCE=pypi" >> $GITHUB_ENV - else - echo "Error: Version ${{ steps.version.outputs.version }} not found in either TestPyPI or PyPI" - exit 1 - fi - - - name: Install llama-stack - run: | - echo "PYPI_SOURCE=${PYPI_SOURCE}" - if [ "${{ github.event_name }}" = "push" ]; then - pip install -e . - else - if [ "$PYPI_SOURCE" = "testpypi" ]; then - pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple llama-stack==${{ steps.version.outputs.version }} - else - pip install llama-stack==${{ steps.version.outputs.version }} - fi - fi - - - name: Build docker image - run: | - echo "PYPI_SOURCE=${PYPI_SOURCE}" - echo "VERSION=${{ steps.version.outputs.version }}" - TEMPLATES=("ollama" "bedrock" "remote-vllm" "fireworks" "together" "tgi" "meta-reference-gpu") - for template in "${TEMPLATES[@]}"; do - if [ "$PYPI_SOURCE" = "testpypi" ]; then - TEST_PYPI_VERSION=${{ steps.version.outputs.version }} llama stack build --template $template --image-type container - else - PYPI_VERSION=${{ steps.version.outputs.version }} llama stack build --template $template --image-type container - fi - done - - - name: List docker images - run: | - docker images - - # TODO (xiyan): make the following 2 steps into a matrix and test all templates other than fireworks - - name: Start up built docker image - run: | - cd distributions/fireworks - if [ "$PYPI_SOURCE" = "testpypi" ]; then - sed -i 's|image: llamastack/distribution-fireworks|image: distribution-fireworks:test-${{ steps.version.outputs.version }}|' ./compose.yaml - else - sed -i 's|image: llamastack/distribution-fireworks|image: distribution-fireworks:${{ steps.version.outputs.version }}|' ./compose.yaml - fi - docker compose up -d - cd .. - # Wait for the container to start - timeout=300 - while ! curl -s -f http://localhost:8321/v1/version > /dev/null && [ $timeout -gt 0 ]; do - echo "Waiting for endpoint to be available..." - sleep 5 - timeout=$((timeout - 5)) - done - - if [ $timeout -le 0 ]; then - echo "Timeout waiting for endpoint to become available" - exit 1 - fi - - - name: Run simple models list test on docker server - run: | - curl http://localhost:8321/v1/models - - # TODO (xiyan): figure out why client cannot find server but curl works - # - name: Run pytest on docker server - # run: | - # pip install pytest pytest-md-report - # export LLAMA_STACK_BASE_URL="http://localhost:8321" - # LLAMA_STACK_BASE_URL="http://localhost:8321" pytest -v tests/client-sdk/inference/test_inference.py --md-report --md-report-verbose=1 - - - name: Push to dockerhub - run: | - echo "PYPI_SOURCE=${PYPI_SOURCE}" - echo "VERSION=${{ steps.version.outputs.version }}" - TEMPLATES=("ollama" "bedrock" "remote-vllm" "fireworks" "together" "tgi" "meta-reference-gpu") - for template in "${TEMPLATES[@]}"; do - if [ "$PYPI_SOURCE" = "testpypi" ]; then - docker tag distribution-$template:test-${{ steps.version.outputs.version }} llamastack/distribution-$template:test-${{ steps.version.outputs.version }} - docker push llamastack/distribution-$template:test-${{ steps.version.outputs.version }} - else - docker tag distribution-$template:${{ steps.version.outputs.version }} llamastack/distribution-$template:${{ steps.version.outputs.version }} - docker tag distribution-$template:${{ steps.version.outputs.version }} llamastack/distribution-$template:latest - docker push llamastack/distribution-$template:${{ steps.version.outputs.version }} - docker push llamastack/distribution-$template:latest - fi - done diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml deleted file mode 100644 index 2e8aaab23..000000000 --- a/.github/workflows/publish-to-test-pypi.yml +++ /dev/null @@ -1,244 +0,0 @@ -name: Publish Python 🐍 distribution 📦 to TestPyPI - -on: - 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 - outputs: - version: ${{ steps.version.outputs.version }} - client_run_id: ${{ steps.trigger-client.outputs.workflow_id }} - model_run_id: ${{ steps.trigger-models.outputs.workflow_id }} - 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 - id: trigger-client - run: | - 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 "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \ - --data "{\"event_type\": \"build-client-package\", \"client_payload\": {\"source\": \"llama-stack-nightly\", \"version\": \"${{ steps.version.outputs.version }}\"}}" \ - -w "\n%{http_code}") - - http_code=$(echo "$response" | tail -n1) - if [ "$http_code" != "204" ]; then - echo "Failed to trigger client workflow" - exit 1 - fi - - # Get the run ID of the triggered workflow - sleep 5 # Wait for workflow to be created - 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" \ - | jq '.workflow_runs[0].id') - echo "workflow_id=$run_id" >> $GITHUB_OUTPUT - - - name: Trigger llama-models workflow - id: trigger-models - run: | - response=$(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 }}\"}}" \ - -w "\n%{http_code}") - - http_code=$(echo "$response" | tail -n1) - if [ "$http_code" != "204" ]; then - echo "Failed to trigger models workflow" - exit 1 - fi - - # Get the run ID of the triggered workflow - sleep 5 # Wait for workflow to be created - run_id=$(curl -s -H "authorization: Bearer ${{ secrets.PAT_TOKEN }}" \ - "https://api.github.com/repos/meta-llama/llama-models/actions/runs?event=repository_dispatch" \ - | jq '.workflow_runs[0].id') - echo "workflow_id=$run_id" >> $GITHUB_OUTPUT - - wait-for-workflows: - name: Wait for triggered workflows - needs: trigger-client-and-models-build - runs-on: ubuntu-latest - steps: - - name: Wait for client workflow - run: | - while true; do - 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 }}" \ - | jq -r '.status') - 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 }}" \ - | jq -r '.conclusion') - - echo "llama-stack-client-python workflow status: $status, conclusion: $conclusion" - - if [ "$status" = "completed" ]; then - if [ "$conclusion" != "success" ]; then - echo "llama-stack-client-python workflow failed" - exit 1 - fi - break - fi - - sleep 10 - done - - - name: Wait for models workflow - run: | - while true; do - 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 }}" \ - | jq -r '.status') - 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 }}" \ - | jq -r '.conclusion') - - echo "llama-models workflow status: $status, conclusion: $conclusion" - - if [ "$status" = "completed" ]; then - if [ "$conclusion" != "success" ]; then - echo "llama-models workflow failed" - exit 1 - fi - break - fi - - sleep 10 - done - - build: - name: Build distribution 📦 - needs: - - wait-for-workflows - - trigger-client-and-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: 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 - - 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 - env: - TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }} - TAVILY_SEARCH_API_KEY: ${{ secrets.TAVILY_SEARCH_API_KEY }} - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Install the package - run: | - max_attempts=6 - attempt=1 - while [ $attempt -le $max_attempts ]; do - 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 - echo "Package installed successfully" - break - fi - if [ $attempt -ge $max_attempts ]; then - echo "Failed to install package after $max_attempts attempts" - exit 1 - fi - attempt=$((attempt + 1)) - sleep 10 - done - - 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 - - name: Test Notebook - run: | - pip install pytest nbval - llama stack build --template together --image-type venv - pytest -v -s --nbval-lax ./docs/getting_started.ipynb - pytest -v -s --nbval-lax ./docs/notebooks/Llama_Stack_Benchmark_Evals.ipynb - - # TODO: add trigger for integration test workflow & docker builds