Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2024 Intel Corporation | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Microservice Test With Helm Charts | |
on: | |
pull_request_target: | |
branches: [main] | |
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped | |
paths: | |
- "!**.md" | |
- "**/deployment/kubernetes/**" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
job1: | |
name: Get-test-matrix | |
runs-on: ubuntu-latest | |
outputs: | |
run_matrix: ${{ steps.get-test-matrix.outputs.run_matrix }} | |
steps: | |
- name: Checkout out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: "refs/pull/${{ github.event.number }}/merge" | |
fetch-depth: 0 | |
- name: Get test matrix | |
id: get-test-matrix | |
run: | | |
set -x | |
base_commit=${{ github.event.pull_request.base.sha }} | |
merged_commit=$(git log -1 --format='%H') | |
values_files=$(git diff --name-only ${base_commit} ${merged_commit} | \ | |
grep "values.yaml" | \ | |
sort -u) # comps/agent/deployment/kubernetes/cpu-values.yaml | |
run_matrix="{\"include\":[" | |
for values_file in ${values_files}; do | |
if [ -f "$values_file" ]; then | |
valuefile=$(basename "$values_file") # cpu-values.yaml | |
if [[ "$values_file" == *"third_parties"* ]]; then #comps/third_parties/bridgetower/deployment/kubernetes/gaudi-values.yaml | |
service=$(echo "$values_file" | cut -d'/' -f2-3) # third_parties/bridgetower | |
else | |
service=$(echo "$values_file" | cut -d'/' -f2) # agent | |
fi | |
echo "service=${service}" | |
if [[ $(echo ${run_matrix} | grep -c "{\"service\":\"${service}\"},") == 0 ]]; then | |
run_matrix="${run_matrix}{\"service\":\"${service}\"}," | |
echo "------------------ add one values file ------------------" | |
fi | |
fi | |
done | |
run_matrix="${run_matrix%,}" | |
run_matrix=$run_matrix"]}" | |
echo "run_matrix=${run_matrix}" | |
echo "run_matrix=${run_matrix}" >> $GITHUB_OUTPUT | |
Chart-test: | |
needs: [job1] | |
if: always() && ${{ fromJSON(needs.job1.outputs.run_matrix).length != 0 }} | |
uses: ./.github/workflows/_run-helm-chart.yml | |
strategy: | |
matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }} | |
with: | |
service: ${{ matrix.service }} | |
mode: "CI" | |
secrets: inherit |