[Feature] Azure automated deployment for OPEA applications - Infosys #474
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: E2E 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: | |
- helm-charts/** | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
CHARTS_DIR: "helm-charts" | |
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: | | |
base_commit=${{ github.event.pull_request.base.sha }} | |
merged_commit=$(git log -1 --format='%H') | |
e2e_charts=$(git diff --name-only ${base_commit} ${merged_commit} | \ | |
grep "^$CHARTS_DIR/" | \ | |
grep -vE 'README.md|CI.md|common|*.sh' | \ | |
cut -d'/' -f2 | sort -u ) | |
common_charts=$(git diff --name-only ${base_commit} ${merged_commit} | \ | |
grep "^$CHARTS_DIR/common" | \ | |
grep -vE 'README.md|*.sh' | \ | |
cut -d'/' -f3 | sort -u ) | |
run_matrix="{\"include\":[" | |
for chart in ${e2e_charts}; do | |
for file in "$CHARTS_DIR/$chart"/ci-*values.yaml; do | |
if [ -f "$file" ]; then | |
filename=$(basename "$file" .yaml) | |
if [[ "$filename" == *"gaudi"* ]]; then | |
run_matrix="${run_matrix}{\"example\":\"${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"}," | |
else | |
run_matrix="${run_matrix}{\"example\":\"${chart}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\"}," | |
fi | |
fi | |
done | |
done | |
for chart in ${common_charts}; do | |
for file in "$CHARTS_DIR/common/$chart"/ci-*values.yaml; do | |
if [ -f "$file" ]; then | |
filename=$(basename "$file" .yaml) | |
if [[ "$filename" == *"gaudi"* ]]; then | |
run_matrix="${run_matrix}{\"example\":\"${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\",\"directory\":\"common\"}," | |
else | |
run_matrix="${run_matrix}{\"example\":\"${chart}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\",\"directory\":\"common\"}," | |
fi | |
fi | |
done | |
done | |
run_matrix=$run_matrix"]}" | |
echo "run_matrix=${run_matrix}" | |
echo "run_matrix=${run_matrix}" >> $GITHUB_OUTPUT | |
Chart-test: | |
needs: [job1] | |
if: always() && ${{ needs.job1.outputs.run_matrix.example.length }} > 0 | |
uses: ./.github/workflows/_helm-e2e.yaml | |
strategy: | |
matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }} | |
with: | |
workload: ${{ matrix.directory }}/${{ matrix.example }} | |
hardware: ${{ matrix.hardware }} | |
valuefile: ${{ matrix.valuefile }} | |
secrets: inherit |