Skip to content

Examples CD workflow on manual event #519

Examples CD workflow on manual event

Examples CD workflow on manual event #519

# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Examples CD workflow on manual event
permissions:
actions: read
contents: read
discussions: read
issues: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
id-token: write
attestations: read
models: read
on:
workflow_dispatch:
inputs:
nodes:
default: "gaudi,xeon"
description: "Hardware to run test gaudi,xeon,rocm,epyc,arc,gaudi3,xeon-gnr"
required: true
type: string
examples:
default: "ChatQnA"
description: 'List of examples to test [AgentQnA,AudioQnA,AvatarChatbot,ChatQnA,CodeGen,CodeTrans,DBQnA,DeepResearchAgent,DocIndexRetriever,DocSum,EdgeCraftRAG,FinanceAgent,GraphRAG,HybridRAG,InstructionTuning,MultimodalQnA,ProductivitySuite,RerankFinetuning,SearchQnA,Text2Image,Translation,VideoQnA,VisualQnA,WorkflowExecAgent]'
required: true
type: string
tag:
default: "latest"
description: "Tag to apply to images"
required: true
type: string
build:
default: true
description: 'Build test required images for Examples'
required: false
type: boolean
test_compose:
default: true
description: 'Test examples with docker compose'
required: false
type: boolean
test_helmchart:
default: true
description: 'Test examples with helm charts'
required: false
type: boolean
opea_branch:
default: "main"
description: 'OPEA branch for image build'
required: false
type: string
inject_commit:
default: false
description: "inject commit to docker images"
required: false
type: boolean
use_model_cache:
default: false
description: "use model cache"
required: false
type: boolean
jobs:
get-test-matrix:
runs-on: ubuntu-latest
outputs:
examples: ${{ steps.get-matrix.outputs.examples }}
nodes: ${{ steps.get-matrix.outputs.nodes }}
steps:
- name: Create Matrix
id: get-matrix
run: |
examples=($(echo ${{ inputs.examples }} | tr ',' ' '))
examples_json=$(printf '%s\n' "${examples[@]}" | sort -u | jq -R '.' | jq -sc '.')
echo "examples=$examples_json" >> $GITHUB_OUTPUT
nodes=($(echo ${{ inputs.nodes }} | tr ',' ' '))
nodes_json=$(printf '%s\n' "${nodes[@]}" | sort -u | jq -R '.' | jq -sc '.')
echo "nodes=$nodes_json" >> $GITHUB_OUTPUT
build-comps-base:
needs: [get-test-matrix]
uses: ./.github/workflows/_build_comps_base_image.yml
with:
node: gaudi
build: ${{ fromJSON(inputs.build) }}
tag: ${{ inputs.tag }}
opea_branch: ${{ inputs.opea_branch }}
run-examples:
permissions:
actions: read
attestations: read
checks: read
discussions: read
models: read
repository-projects: read
id-token: write
contents: read
issues: write
pages: write
pull-requests: write
security-events: read
needs: [get-test-matrix, build-comps-base]
strategy:
matrix:
example: ${{ fromJson(needs.get-test-matrix.outputs.examples) }}
node: ${{ fromJson(needs.get-test-matrix.outputs.nodes) }}
fail-fast: false
uses: ./.github/workflows/_example-workflow.yml
with:
node: ${{ matrix.node }}
example: ${{ matrix.example }}
tag: ${{ inputs.tag }}
build: ${{ fromJSON(inputs.build) }}
test_compose: ${{ fromJSON(inputs.test_compose) }}
test_helmchart: ${{ fromJSON(inputs.test_helmchart) }}
opea_branch: ${{ inputs.opea_branch }}
inject_commit: ${{ inputs.inject_commit }}
use_model_cache: ${{ inputs.use_model_cache }}
secrets: inherit