-
Notifications
You must be signed in to change notification settings - Fork 80
104 lines (94 loc) · 2.97 KB
/
helm-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
103
104
name: Test Helm Chart
on:
pull_request:
paths:
- '!*.md'
- 'deploy/charts/version-checker/**'
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: Lint Helm Chart
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: azure/setup-helm@v3
- run: helm lint deploy/charts/version-checker
docs:
name: Generate Helm Docs
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Check for values.yaml changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
values:
- 'deploy/charts/version-checker/values.yaml'
- 'deploy/charts/version-checker/Chart.yaml'
- name: Install Helm Docs
if: steps.filter.outputs.values == 'true'
uses: envoy/[email protected]
with:
version: 1.11.0
- name: Update Helm Docs
if: steps.filter.outputs.values == 'true'
run: |
set -ex
cd deploy/charts/version-checker
helm-docs
- name: Check for README.md changes
uses: dorny/paths-filter@v2
id: filter-readme
with:
base: HEAD
filters: |
readme:
- 'deploy/charts/version-checker/README.md'
- name: Commit Helm Docs
if: steps.filter-readme.outputs.readme == 'true'
run: |
set -ex
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add deploy/charts/version-checker
git commit -m "[HELM] Update helm docs"
- name: Push Changes
if: steps.filter-readme.outputs.readme == 'true'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
test:
name: Run unit tests for Helm Chart
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: azure/setup-helm@v3
with:
token: ${{ github.token }}
- name: Install helm Plugins
run: |
if [ ! -e "${HELM_PLUGINS}/helm-unittest" ]; then
helm plugin install https://github.com/helm-unittest/helm-unittest.git
fi
- name: Run Tests
run: |
if [ ! -e "deploy/charts/version-checker/tests" ]; then
echo "Not running tests, directory doesn't exist: deploy/charts/version-checker/tests"
exit 0
fi
helm unittest deploy/charts/version-checker