Skip to content

Commit b3ab697

Browse files
authored
CI: add tests & linting for helm charts (#121)
* test helm-chart-testing * upgrade helm/chart-testing-action -> 2.6.1 * - Resolve comments - HF: adjust condition and catch changed files * Add ct.yaml config to lint and install step * remove blank line
1 parent f392581 commit b3ab697

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/lint-test.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Lint and Test Charts
2+
3+
on: [pull_request,push]
4+
5+
jobs:
6+
lint-test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Set up Helm
15+
uses: azure/setup-helm@v4
16+
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.9'
20+
check-latest: true
21+
22+
- name: Set up chart-testing
23+
uses: helm/[email protected]
24+
25+
- name: Run chart-testing (list-changed)
26+
id: list-changed
27+
run: |
28+
changed_files=$(ct list-changed --config ct.yaml --target-branch ${{ github.event.repository.default_branch }} 2>/dev/null | wc -l | tr -d ' ')
29+
echo "Changed files detected: $changed_files"
30+
if [ $changed_files -ne 0 ]; then
31+
echo "changed=true" >> $GITHUB_OUTPUT
32+
else
33+
echo "changed=false" >> $GITHUB_OUTPUT
34+
fi
35+
36+
- name: Run chart-testing (lint)
37+
if: steps.list-changed.outputs.changed == 'true'
38+
run: ct lint --config ct.yaml --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false
39+
40+
- name: Create kind cluster
41+
if: steps.list-changed.outputs.changed == 'true'
42+
uses: helm/[email protected]
43+
44+
- name: Run chart-testing (install)
45+
if: steps.list-changed.outputs.changed == 'true'
46+
run: ct install --config ct.yaml --target-branch ${{ github.event.repository.default_branch }}

ct.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
chart-dirs:
2+
- ./

0 commit comments

Comments
 (0)