-
Notifications
You must be signed in to change notification settings - Fork 2
102 lines (90 loc) · 3.03 KB
/
lint-and-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
95
96
97
98
99
100
101
102
name: Lint and test PR
on: pull_request
jobs:
chart-lint:
name: Lint Helm charts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install helm/chart-testing
uses: helm/[email protected]
- name: Lint charts
run: ct --config .github/ct.yaml lint --all
chart-unittest:
name: Unit test Helm charts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install helm-unittest plugin
run: helm plugin install https://github.com/helm-unittest/helm-unittest
- name: Run unit tests
run: |
for chart in charts/*; do
if [ -d "$chart/tests/" ]; then
helm unittest $chart -3
else
echo "::warning file=$chart,title=Skipping unit test for $chart::$chart does not have a tests/ folder"
fi
done
chart-install:
name: Installation test for Helm charts
runs-on: ubuntu-latest
needs:
# This test is expensive so only run it when cheap tests pass:
- chart-lint
- chart-unittest
steps:
- name: Checkout code
uses: actions/checkout@v3
# Install Minikube to test chart installation
- name: Install Minikube
uses: manusa/[email protected]
with:
minikube version: v1.31.0
kubernetes version: v1.27.4
github token: ${{ secrets.GITHUB_TOKEN }}
driver: docker
start args: "--container-runtime=containerd"
# Test chart installation
- name: Install helm/chart-testing
uses: helm/[email protected]
- name: Test charts' installation path
run: |
ct install --all \
--config .github/ct.yaml \
--helm-extra-args "--timeout 1m"
# Install charts with the e2e values (tested also in lint-charts job)
- name: Installing charts being tested
run: |
for CHART in charts/*; do
if [ -f "$CHART/ci/e2e-values.yaml" ]; then
helm upgrade --install \
"$(basename $CHART)" "$CHART" \
--create-namespace --namespace e2e-staless-dns \
--values "$CHART/ci/e2e-values.yaml" \
--wait --timeout 60s
fi
done
- name: Configure testing scenarios
run: |
helm upgrade --install \
test-chart "testing/chart" \
--create-namespace --namespace e2e-staless-dns \
--wait --timeout 60s
# In this first iteration, readineess probes may not be reliable.
- name: Wait 5 seconds for everything to settle
run: sleep 5
# Begin e2e test.
- name: Testing e2e
run: |
IP=$(minikube ip)
errors=0
for TEST in testing/*.sh; do
echo "Running tests for $(basename $TEST)"
bash "$TEST" $IP || ((errors++))
done
exit $errors