1+ name : Helm Chart Tests
2+
3+ on :
4+ push :
5+ branches : [ main, develop, feat/* ]
6+ paths :
7+ - ' helm-chart/**'
8+ - ' .github/workflows/helm-chart-test.yml'
9+ pull_request :
10+ branches : [ main, develop ]
11+ paths :
12+ - ' helm-chart/**'
13+ - ' .github/workflows/helm-chart-test.yml'
14+
15+ env :
16+ HELM_VERSION : v3.13.0
17+ KUBECTL_VERSION : v1.28.0
18+ KIND_VERSION : v0.20.0
19+
20+ jobs :
21+ lint :
22+ name : Lint Helm Chart
23+ runs-on : ubuntu-latest
24+ steps :
25+ - name : Checkout
26+ uses : actions/checkout@v4
27+
28+ - name : Set up Helm
29+ uses : azure/setup-helm@v3
30+ with :
31+ version : ${{ env.HELM_VERSION }}
32+
33+ - name : Setup Helm repositories
34+ uses : ./.github/actions/setup-helm-repos
35+
36+ - name : Lint Helm chart
37+ run : |
38+ cd helm-chart/stac-fastapi
39+ helm dependency update
40+ helm lint .
41+
42+ test-matrix :
43+ name : Test Chart
44+ runs-on : ubuntu-latest
45+ needs : lint
46+ strategy :
47+ matrix :
48+ backend : [elasticsearch, opensearch]
49+ kubernetes-version : [v1.27.3, v1.28.0]
50+ steps :
51+ - name : Checkout
52+ uses : actions/checkout@v4
53+
54+ - name : Set up Helm
55+ uses : azure/setup-helm@v3
56+ with :
57+ version : ${{ env.HELM_VERSION }}
58+
59+ - name : Set up kubectl
60+ uses : azure/setup-kubectl@v3
61+ with :
62+ version : ${{ env.KUBECTL_VERSION }}
63+
64+ - name : Set up Kind
65+ 66+ with :
67+ version : ${{ env.KIND_VERSION }}
68+ node_image : kindest/node:${{ matrix.kubernetes-version }}
69+ cluster_name : stac-fastapi-test
70+
71+ - name : Setup Helm repositories
72+ uses : ./.github/actions/setup-helm-repos
73+
74+ - name : Run matrix tests
75+ env :
76+ BACKEND : ${{ matrix.backend }}
77+ MATRIX_MODE : true
78+ run : |
79+ chmod +x ./helm-chart/test-chart.sh
80+ ./helm-chart/test-chart.sh -m -b ${{ matrix.backend }} ci
81+
82+ - name : Upload test reports
83+ if : always()
84+ uses : actions/upload-artifact@v3
85+ with :
86+ name : test-report-${{ matrix.backend }}-k8s-${{ matrix.kubernetes-version }}
87+ path : test-report-*.json
88+
89+ integration-test :
90+ name : Integration Tests
91+ runs-on : ubuntu-latest
92+ needs : test-matrix
93+ if : github.event_name == 'pull_request'
94+ steps :
95+ - name : Checkout
96+ uses : actions/checkout@v4
97+
98+ - name : Set up Helm
99+ uses : azure/setup-helm@v3
100+ with :
101+ version : ${{ env.HELM_VERSION }}
102+
103+ - name : Set up kubectl
104+ uses : azure/setup-kubectl@v3
105+ with :
106+ version : ${{ env.KUBECTL_VERSION }}
107+
108+ - name : Set up Kind
109+ 110+ with :
111+ version : ${{ env.KIND_VERSION }}
112+ cluster_name : stac-fastapi-integration
113+
114+ - name : Setup Helm repositories
115+ uses : ./.github/actions/setup-helm-repos
116+
117+ - name : Run full integration tests
118+ run : |
119+ chmod +x ./helm-chart/test-chart.sh
120+ ./helm-chart/test-chart.sh test-all
121+
122+ - name : Test upgrade scenarios
123+ run : |
124+ # Test elasticsearch to opensearch migration scenario
125+ ./helm-chart/test-chart.sh -b elasticsearch install
126+ ./helm-chart/test-chart.sh validate
127+ ./helm-chart/test-chart.sh cleanup
128+
129+ # Test opensearch deployment
130+ ./helm-chart/test-chart.sh -b opensearch install
131+ ./helm-chart/test-chart.sh validate
132+ ./helm-chart/test-chart.sh cleanup
133+
134+ security-scan :
135+ name : Security Scan
136+ runs-on : ubuntu-latest
137+ needs : lint
138+ steps :
139+ - name : Checkout
140+ uses : actions/checkout@v4
141+
142+ - name : Set up Helm
143+ uses : azure/setup-helm@v3
144+ with :
145+ version : ${{ env.HELM_VERSION }}
146+
147+ - name : Setup Helm repositories
148+ uses : ./.github/actions/setup-helm-repos
149+
150+ - name : Run Checkov security scan
151+ uses : bridgecrewio/checkov-action@master
152+ with :
153+ directory : helm-chart/
154+ framework : kubernetes
155+ output_format : sarif
156+ output_file_path : reports/results.sarif
157+
158+ - name : Upload Checkov results
159+ if : always()
160+ uses : github/codeql-action/upload-sarif@v2
161+ with :
162+ sarif_file : reports/results.sarif
163+
164+ chart-testing :
165+ name : Chart Testing (ct)
166+ runs-on : ubuntu-latest
167+ needs : lint
168+ steps :
169+ - name : Checkout
170+ uses : actions/checkout@v4
171+ with :
172+ fetch-depth : 0
173+
174+ - name : Set up Helm
175+ uses : azure/setup-helm@v3
176+ with :
177+ version : ${{ env.HELM_VERSION }}
178+
179+ - name : Set up Python
180+ uses : actions/setup-python@v4
181+ with :
182+ python-version : 3.x
183+
184+ - name : Set up chart-testing
185+ 186+
187+ - name : Setup Helm repositories
188+ uses : ./.github/actions/setup-helm-repos
189+
190+ - name : Run chart-testing (list)
191+ run : ct list --config .github/ct.yaml
192+
193+ - name : Run chart-testing (lint)
194+ run : ct lint --config .github/ct.yaml
195+
196+ - name : Set up Kind cluster
197+ 198+ with :
199+ version : ${{ env.KIND_VERSION }}
200+
201+ - name : Run chart-testing (install)
202+ run : ct install --config .github/ct.yaml
0 commit comments