-
Notifications
You must be signed in to change notification settings - Fork 7
94 lines (81 loc) · 3.44 KB
/
test.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
87
88
89
90
91
92
93
94
name: Test Charts
on: pull_request
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.8.1
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale),
# yamllint (https://github.com/adrienverge/yamllint) which require Python and
# generate-creds step below which uses python to parse yaml file.
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
with:
version: v3.7.0
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .github/config/ct.yaml | tr '\n' ' ')
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "charts_changed=$changed" >> $GITHUB_OUTPUT
fi
- name: Add dependency chart repos
run: |
for dir in $(ls -d charts/*/); do
num_of_deps=$(( $(helm dependency list $dir 2> /dev/null | tail +2 | wc -l ) -1 ))
if [ $num_of_deps -gt 0 ]; then
helm dependency list $dir 2> /dev/null | tail +2 | head -n $num_of_deps | awk '{ print " " $1 " " $3 }' | grep -v "file://" | xargs -n 2 helm repo add --force-update
fi
done
- name: Install plugin and run Unit-tests on changed charts
id: unit-tests
env:
CHARTS_CHANGED: ${{ steps.list-changed.outputs.charts_changed }}
# Pinning the unittest plugin version as the latest master has a regression in matchRegex
UNITTEST_PLUGIN_VERSION: v0.2.11
run: |
helm plugin install https://github.com/quintush/helm-unittest --version=$UNITTEST_PLUGIN_VERSION > /dev/null 2>&1
for chart in $CHARTS_CHANGED; do
chart=`echo $chart | sed 's/ *$//g'`
cd $chart
helm dep build > /dev/null 2>&1
helm unittest --helm3 -u -d .
cd ../../
done
- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'
with:
node_image: kindest/node:v1.22.7
- name: Install metallb in kind cluster for load balancer services
if: steps.list-changed.outputs.changed == 'true'
run: |
./scripts/install_metallib.sh
- name: Add cluster credentials as a file if merlin/turing is being installed
env:
CHARTS_CHANGED: ${{ steps.list-changed.outputs.charts_changed }}
run: |
if [[ $(echo $CHARTS_CHANGED | grep 'charts/\(merlin\|turing\|caraml\)') ]]; then
CHARTS_CHANGED=$CHARTS_CHANGED ./scripts/generate-cluster-creds.sh kind chart-testing
fi
- name: Run chart-testing (install)
run: ct install --config .github/config/ct.yaml --excluded-charts kserve,common --print-config
- name: Run chart-testing for kserve (install)
env:
CHARTS_CHANGED: ${{ steps.list-changed.outputs.charts_changed }}
run: |
if [[ $(echo $CHARTS_CHANGED | grep 'charts/kserve') ]]; then
ct install --charts charts/kserve --namespace kserve --helm-extra-set-args "--create-namespace" --debug
fi