Skip to content

Commit 0e7da11

Browse files
authored
Merge pull request #35 from mkilchhofer/feature/change_ci_workflow
chore: Adapt workflow to common helm testing
2 parents 66bc827 + facf41d commit 0e7da11

File tree

3 files changed

+69
-25
lines changed

3 files changed

+69
-25
lines changed

.github/configs/ct.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Reference: https://github.com/helm/chart-testing/blob/master/doc/ct_lint-and-install.md
2+
# Don't add the 'debug' attribute, otherwise the workflow won't work anymore
3+
# Only Used for the CT Lint Stage
4+
remote: origin
5+
target-branch: main
6+
chart-dirs:
7+
- charts
8+
chart-repos: []
9+
validate-chart-schema: false
10+
validate-maintainers: true
11+
validate-yaml: true
12+
exclude-deprecated: true
13+
excluded-charts: []

.github/configs/lintconf.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
rules:
3+
braces:
4+
min-spaces-inside: 0
5+
max-spaces-inside: 0
6+
min-spaces-inside-empty: -1
7+
max-spaces-inside-empty: -1
8+
brackets:
9+
min-spaces-inside: 0
10+
max-spaces-inside: 0
11+
min-spaces-inside-empty: -1
12+
max-spaces-inside-empty: -1
13+
colons:
14+
max-spaces-before: 0
15+
max-spaces-after: 1
16+
commas:
17+
max-spaces-before: 0
18+
min-spaces-after: 1
19+
max-spaces-after: 1
20+
comments:
21+
require-starting-space: true
22+
min-spaces-from-content: 1
23+
document-end: disable
24+
document-start: disable # No --- to start a file
25+
empty-lines:
26+
max: 2
27+
max-start: 0
28+
max-end: 0
29+
hyphens:
30+
max-spaces-after: 1
31+
indentation:
32+
spaces: consistent
33+
indent-sequences: whatever # - list indentation will handle both indentation and without
34+
check-multi-line-strings: false
35+
key-duplicates: enable
36+
line-length: disable # Lines can be any length
37+
new-line-at-end-of-file: enable
38+
new-lines:
39+
type: unix
40+
trailing-spaces: enable
41+
truthy:
42+
level: warning

.github/workflows/helm-test.yml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,24 @@ jobs:
3434
- name: Set up chart-testing
3535
uses: helm/chart-testing-action@v2.3.1
3636

37-
- name: Get changed files in the docs folder
38-
id: files-changed
39-
uses: tj-actions/changed-files@v35
40-
with:
41-
files: |
42-
charts/**
43-
44-
# change detection in ct seems to not detect some changes. Using simple file modification for now.
45-
# - name: Run chart-testing (list-changed)
46-
# id: list-changed
47-
# run: |
48-
# changed=$(ct list-changed --chart-dirs . --target-branch ${{ github.event.repository.default_branch }})
49-
# if [[ -n "$changed" ]]; then
50-
# echo "chart-changed=true" >> $GITHUB_OUTPUT
51-
# fi
52-
# - name: Run chart-testing (lint changed)
53-
# run: ct lint --chart-dirs . --target-branch ${{ github.event.repository.default_branch }}
37+
- name: List changed charts
38+
id: list-changed
39+
run: |
40+
## If executed with debug this won't work anymore.
41+
changed=$(ct --config ./.github/configs/ct.yaml list-changed)
42+
charts=$(echo "$changed" | tr '\n' ' ' | xargs)
43+
if [[ -n "$changed" ]]; then
44+
echo "changed=true" >> $GITHUB_STATE
45+
echo "changed_charts=$charts" >> $GITHUB_STATE
46+
fi
5447
5548
- name: Run chart-testing (lint)
56-
run: ct lint --all
49+
run: ct lint --debug --config ./.github/configs/ct.yaml --lint-conf ./.github/configs/lintconf.yaml
5750

5851
- name: Create kind cluster
5952
uses: helm/kind-action@v1.4.0
60-
# if: steps.list-changed.outputs.chart-changed == 'true' || steps.files-changed.outputs.any_modified == 'true'
61-
if: steps.files-changed.outputs.any_modified == 'true'
62-
63-
# - name: Run chart-testing (install changed)
64-
# run: ct install --chart-dirs . --target-branch ${{ github.event.repository.default_branch }} --upgrade
53+
if: steps.list-changed.outputs.changed == 'true'
6554

6655
- name: Run chart-testing (install)
67-
run: ct install --all
68-
if: steps.files-changed.outputs.any_modified == 'true'
56+
run: ct install --config ./.github/configs/ct.yaml
57+
if: steps.list-changed.outputs.changed == 'true'

0 commit comments

Comments
 (0)