-
Notifications
You must be signed in to change notification settings - Fork 60
86 lines (79 loc) · 3.15 KB
/
pr-chart-e2e.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# 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