Skip to content
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

Convert ci-shark-ai.yml to pkgci_shark_ai.yml. #625

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
2 changes: 1 addition & 1 deletion .github/workflows/build_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12
cache: "pip"
- name: Install Python packages
run: |
pip install packaging
Expand Down Expand Up @@ -134,6 +133,7 @@ jobs:
env:
OUTPUT_DIR: "${{ github.workspace }}/bindist"
OVERRIDE_PYTHON_VERSIONS: "${{ matrix.python-version }}"
SHORTFIN_ENABLE_TRACING: "ON"
run: |
[ -e ./bindist/* ] && rm ./bindist/*
./c/shortfin/build_tools/build_linux_package.sh
Expand Down
75 changes: 0 additions & 75 deletions .github/workflows/ci-shark-ai.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/pkgci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2024 Advanced Micro Devices, Inc.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: PkgCI

on:
workflow_dispatch:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
build_packages:
name: Build Packages
uses: ./.github/workflows/pkgci_build_packages.yml

test_shark_ai:
name: Test shark-ai
needs: [build_packages]
uses: ./.github/workflows/pkgci_shark_ai.yml
71 changes: 71 additions & 0 deletions .github/workflows/pkgci_build_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copyright 2024 Advanced Micro Devices, Inc.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: PkgCI Build Packages

on:
workflow_call:

permissions:
contents: read

jobs:
build_packages:
runs-on: ubuntu-24.04
env:
CACHE_DIR: ${{ github.workspace }}/.shark-ai-cache
OUTPUT_DIR: "${{ github.workspace }}/bindist"

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12

# Setup metadata.
- name: Install Python packages
run: pip install packaging
- name: Generate dev package versions
id: version_rc
run: |
version_suffix=".dev0+${{ github.sha }}"
echo "version_suffix=${version_suffix}" >> $GITHUB_ENV
sharktank_package_version=$(python3 build_tools/python_deploy/compute_local_version.py --version-suffix=${version_suffix} sharktank)
shortfin_package_version=$(python3 build_tools/python_deploy/compute_local_version.py --version-suffix=${version_suffix} shortfin)
sharkai_package_version=$(python3 build_tools/python_deploy/compute_common_version.py -rc --version-suffix=${version_suffix} --write-json)

- name: Enable cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ${{ env.CACHE_DIR }}
key: shark-ai-pkgci-linux-packages-x86_64-v1-${{ github.sha }}
restore-keys: |
shark-ai-pkgci-linux-packages-x86_64-v1-

# Build dev packages.
- name: Build sharktank
run: |
./sharktank/build_tools/build_linux_package.sh
- name: Build shortfin
env:
OVERRIDE_PYTHON_VERSIONS: cp311-cp311
SHORTFIN_ENABLE_TRACING: "OFF"
run: |
./shortfin/build_tools/build_linux_package.sh
- name: Build shark-ai
run: |
./build_tools/python_deploy/write_requirements.py --version-suffix=${version_suffix}
./shark-ai/build_tools/build_linux_package.sh

# Upload.
- name: Upload python wheels
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
if-no-files-found: error
name: linux_x86_64_dev_packages
path: bindist
74 changes: 74 additions & 0 deletions .github/workflows/pkgci_shark_ai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright 2024 Advanced Micro Devices, Inc.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: PkgCI - shark-ai

on:
workflow_call:
inputs:
artifact_run_id:
type: string
default: ""
workflow_dispatch:
inputs:
artifact_run_id:
type: string
description: "Id for a workflow run that produced dev packages"
default: ""

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
test_shortfin_llm_server:
name: "Integration Tests - Shortfin LLM Server"
strategy:
matrix:
version: [3.11]
fail-fast: false
runs-on: nodai-amdgpu-mi250-x86-64
defaults:
run:
shell: bash
env:
PACKAGE_DOWNLOAD_DIR: ${{ github.workspace }}/.packages
VENV_DIR: ${{ github.workspace }}/.venv
steps:
- name: "Checkout Code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Setting up Python"
id: setup_python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{matrix.version}}

- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: linux_x86_64_dev_packages
path: ${{ env.PACKAGE_DOWNLOAD_DIR }}
- name: Setup venv
run: |
./build_tools/pkgci/setup_venv.py ${VENV_DIR} \
--artifact-path=${PACKAGE_DOWNLOAD_DIR} \
--fetch-gh-workflow=${{ inputs.artifact_run_id }}

- name: Install nightly IREE packages
run: |
source ${VENV_DIR}/bin/activate
uv pip install "git+https://github.com/iree-org/iree-turbine.git#egg=iree-turbine"
uv pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \
iree-base-compiler \
iree-base-runtime

- name: Run LLM Integration Tests
run: |
source ${VENV_DIR}/bin/activate
pytest -v app_tests/integration_tests/llm/shortfin --log-cli-level=INFO
Loading
Loading