Files
2026-07-13 12:24:33 +08:00

175 lines
5.1 KiB
YAML

name: CPU Device Tests
# CPU device tests: server bench + vLLM e2e. Both job types share a
# single environment (built once per OS) to avoid re-installing vLLM.
on:
workflow_call:
workflow_dispatch:
pull_request:
branches:
- "dev"
- "release-**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
lmcache: >-
${{
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_call' ||
steps.filter.outputs.lmcache == 'true'
}}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
if: github.event_name == 'push'
with:
fetch-depth: 2
- uses: dorny/paths-filter@v3
if: >-
github.event_name == 'push' ||
github.event_name == 'pull_request'
id: filter
with:
filters: |
lmcache:
- 'lmcache/**'
- 'pyproject.toml'
- 'setup.py'
- 'requirements/**.txt'
- '.github/workflows/cpu_device.yml'
- '.github/scripts/cpu_device_test.sh'
- '.github/scripts/cpu_server_bench_test.sh'
- '.github/scripts/cpu_vllm_e2e_test.sh'
- '.github/scripts/install_vllm_cpu.sh'
- '.github/scripts/install_lmcache_cpu.sh'
- '.github/scripts/download_model.sh'
- '.github/scripts/run-cpu-e2e-validation.sh'
- '!operator/**'
cpu-device-test:
needs: changes
if: needs.changes.outputs.lmcache == 'true'
name: CPU device (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-latest]
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 1
- name: Setup Python 3.12
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
pyproject.toml
requirements/*.txt
- name: Install FFmpeg (macOS)
if: runner.os == 'macOS'
run: |
if ! command -v ffmpeg >/dev/null 2>&1; then
brew install ffmpeg
else
echo "ffmpeg already installed: $(ffmpeg -version | head -n1)"
fi
- name: Cache opt-125m model (GitHub release)
uses: actions/cache@v4
with:
path: ~/.cache/huggingface
key: opt-125m-gh-v2
- name: Install vLLM CPU (prebuilt nightly from PyPI)
run: bash .github/scripts/install_vllm_cpu.sh
- name: Install lmcache (CPU-only, no vLLM)
run: bash .github/scripts/install_lmcache_cpu.sh
- name: Download facebook/opt-125m (GitHub release)
run: bash .github/scripts/download_opt125m_github.sh
- name: Server bench — LMCache-driven
run: |
LMCACHE_BENCH_TRANSFER_MODE=lmcache_driven \
LMCACHE_HTTP_PORT_BENCH=18080 \
LMCACHE_ZMQ_PORT_BENCH=15555 \
bash .github/scripts/cpu_device_test.sh server_bench
- name: Server bench — Engine-driven
run: |
LMCACHE_BENCH_TRANSFER_MODE=engine_driven \
LMCACHE_HTTP_PORT_BENCH=18081 \
LMCACHE_ZMQ_PORT_BENCH=15556 \
bash .github/scripts/cpu_device_test.sh server_bench
- name: vLLM e2e — Engine-driven (pickle)
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
LMCACHE_E2E_TRANSPORT_MODE=pickle \
LMCACHE_HTTP_PORT_E2E=18082 \
LMCACHE_ZMQ_PORT_E2E=15557 \
VLLM_PORT_E2E=18000 \
bash .github/scripts/cpu_device_test.sh vllm_e2e
# POSIX SHM transport is Linux-only.
- name: vLLM e2e — Engine-driven (shm)
if: runner.os == 'Linux'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
LMCACHE_E2E_TRANSPORT_MODE=shm \
LMCACHE_HTTP_PORT_E2E=18083 \
LMCACHE_ZMQ_PORT_E2E=15558 \
VLLM_PORT_E2E=18001 \
bash .github/scripts/cpu_device_test.sh vllm_e2e
- name: vLLM e2e — Engine-driven
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
LMCACHE_E2E_TRANSPORT_MODE=engine_driven \
LMCACHE_HTTP_PORT_E2E=18084 \
LMCACHE_ZMQ_PORT_E2E=15559 \
VLLM_PORT_E2E=18002 \
bash .github/scripts/cpu_device_test.sh vllm_e2e
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: cpu-device-logs-${{ matrix.os }}
path: |
/tmp/cpu_device_*.log
if-no-files-found: ignore