106 lines
3.9 KiB
YAML
106 lines
3.9 KiB
YAML
# Copyright (C) 2024 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
name: Comps jobs
|
|
permissions: read-all
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
service:
|
|
required: true
|
|
type: string
|
|
tag:
|
|
default: "comps"
|
|
required: false
|
|
type: string
|
|
build:
|
|
default: true
|
|
required: false
|
|
type: boolean
|
|
test:
|
|
default: true
|
|
description: "Test comps with docker compose"
|
|
required: false
|
|
type: boolean
|
|
mode:
|
|
default: "CD"
|
|
description: "Whether the test range is CI, CD or CICD"
|
|
required: false
|
|
type: string
|
|
|
|
jobs:
|
|
####################################################################################################
|
|
# Image Build
|
|
####################################################################################################
|
|
build-images:
|
|
runs-on: "docker-build-gaudi"
|
|
continue-on-error: true
|
|
outputs:
|
|
file_exists: ${{ steps.get-yaml-path.outputs.file_exists }}
|
|
steps:
|
|
- name: Clean Up Working Directory
|
|
run: sudo rm -rf ${{github.workspace}}/*
|
|
|
|
- name: Checkout out Repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Clone required Repo
|
|
id: get-yaml-path
|
|
run: |
|
|
cd ${{ github.workspace }}/.github/workflows/docker/compose
|
|
# service=$(echo ${{ inputs.service }} | cut -d'_' -f1)
|
|
docker_compose_yml=${{ github.workspace }}/.github/workflows/docker/compose/${{ inputs.service }}-compose.yaml
|
|
echo "docker_compose_path=${docker_compose_yml}" >> $GITHUB_OUTPUT
|
|
if [ -f "$docker_compose_yml" ]; then
|
|
echo "file_exists=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "The $docker_compose_yml does not exist!"
|
|
echo "file_exists=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
cd ${{ github.workspace }}
|
|
if [[ $(grep -c "vllm-openvino:" ${docker_compose_yml}) != 0 ]]; then
|
|
git clone https://github.com/vllm-project/vllm.git vllm-openvino
|
|
cd ./vllm-openvino && git checkout v0.6.1 && git rev-parse HEAD && cd ../
|
|
fi
|
|
if [[ $(grep -c "vllm-gaudi:" ${docker_compose_yml}) != 0 ]]; then
|
|
git clone https://github.com/HabanaAI/vllm-fork.git vllm-fork
|
|
fi
|
|
- name: Get build list
|
|
id: get-build-list
|
|
env:
|
|
docker_compose_path: ${{ steps.get-yaml-path.outputs.docker_compose_path }}
|
|
mode: ${{ inputs.mode }}
|
|
run: |
|
|
build_list=$(bash ${{ github.workspace }}/.github/workflows/scripts/get_cicd_list.sh "${mode}" ${docker_compose_path})
|
|
echo "${build_list}"
|
|
if [ -z "${build_list}" ]; then
|
|
echo "empty=true" >> $GITHUB_OUTPUT
|
|
echo "${{ inputs.service }} have no ${mode} part."
|
|
else
|
|
echo "empty=false" >> $GITHUB_OUTPUT
|
|
echo "build_list=${build_list}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Build Image
|
|
if: ${{ fromJSON(inputs.build) && steps.get-yaml-path.outputs.file_exists == 'true' && steps.get-build-list.outputs.empty == 'false' }}
|
|
uses: opea-project/validation/actions/image-build@main
|
|
with:
|
|
work_dir: ${{ github.workspace }}
|
|
docker_compose_path: ${{ steps.get-yaml-path.outputs.docker_compose_path }}
|
|
registry: ${OPEA_IMAGE_REPO}opea
|
|
service_list: ${{ steps.get-build-list.outputs.build_list }}
|
|
tag: ${{ inputs.tag }}
|
|
|
|
####################################################################################################
|
|
# Docker Compose Test
|
|
####################################################################################################
|
|
test-service-compose:
|
|
needs: [build-images]
|
|
if: ${{ fromJSON(inputs.test) }}
|
|
uses: ./.github/workflows/_run-docker-compose.yml
|
|
with:
|
|
tag: ${{ inputs.tag }}
|
|
service: ${{ inputs.service }}
|
|
secrets: inherit
|