1010permissions : {}
1111
1212jobs :
13- build :
13+ lint-chart :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Harden Runner
17+ uses : step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
18+ with :
19+ egress-policy : audit
20+
21+ - name : Checkout
22+ uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
23+ with :
24+ fetch-depth : 0
25+
26+ - name : Set up Helm
27+ uses : azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
28+ with :
29+ version : v3.4.0
30+
31+ - uses : actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
32+ with :
33+ python-version : 3.7
34+
35+ - name : Set up chart-testing
36+ uses : helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0
37+
38+ - name : Run chart-testing (lint)
39+ run : ct lint --target-branch=master --chart-dirs chart --check-version-increment=false
40+
41+ lint :
1442 runs-on : ubuntu-latest
1543 steps :
1644 - name : Harden Runner
3765 run : make vet
3866 - name : lint
3967 run : make lint
68+ - name : Check if working tree is dirty
69+ run : |
70+ if [[ $(git diff --stat) != '' ]]; then
71+ git --no-pager diff
72+ echo 'run make test and commit changes'
73+ exit 1
74+ fi
75+
76+ build :
77+ runs-on : ubuntu-latest
78+ steps :
79+ - name : Harden Runner
80+ uses : step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
81+ with :
82+ egress-policy : audit
83+
84+ - name : Checkout
85+ uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
86+ - name : Setup Go
87+ uses : actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
88+ with :
89+ go-version : 1.20.5
90+ - name : Restore Go cache
91+ uses : actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
92+ with :
93+ path : ~/go/pkg/mod
94+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
95+ restore-keys : |
96+ ${{ runner.os }}-go-
4097 - name : Run tests
4198 run : make test
4299 - name : Build binary
@@ -45,13 +102,6 @@ jobs:
45102 uses : shogo82148/actions-goveralls@df920a6a2468668dfcf71a0b43817f89eaa5ea04 # v1.7.0
46103 with :
47104 path-to-profile : coverage.out
48- - name : Check if working tree is dirty
49- run : |
50- if [[ $(git diff --stat) != '' ]]; then
51- git --no-pager diff
52- echo 'run make test and commit changes'
53- exit 1
54- fi
55105 - name : Build container image
56106 run : |
57107 make docker-build
@@ -69,6 +119,61 @@ jobs:
69119 profiles=$(ls config/tests/cases | jq -R -s -c 'split("\n")[:-1]')
70120 echo $profiles
71121 echo "::set-output name=matrix::$profiles"
122+
123+ test-chart :
124+ runs-on : ubuntu-latest
125+ needs :
126+ - build
127+ - lint-chart
128+ steps :
129+ - name : Harden Runner
130+ uses : step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
131+ with :
132+ egress-policy : audit
133+
134+ - name : Checkout
135+ uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
136+ with :
137+ fetch-depth : 0
138+
139+ - name : Set up Helm
140+ uses : azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
141+ with :
142+ version : v3.4.0
143+
144+ - uses : actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
145+ with :
146+ python-version : 3.7
147+
148+ - name : Set up chart-testing
149+ uses : helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0
150+
151+ - name : Run chart-testing (list-changed)
152+ id : list-changed
153+ run : |
154+ changed=$(ct list-changed --target-branch=master --chart-dirs chart)
155+ if [[ -n "$changed" ]]; then
156+ echo "::set-output name=changed::true"
157+ fi
158+
159+ - name : Create kind cluster
160+ uses : helm/kind-action@fa81e57adff234b2908110485695db0f181f3c67 # v1.7.0
161+ if : steps.list-changed.outputs.changed == 'true'
162+
163+ - name : Download exporter container
164+ uses : actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
165+ with :
166+ name : exporter-container
167+ path : /tmp
168+ - name : Load image
169+ run : |
170+ docker load --input /tmp/exporter-container.tar
171+ docker tag ghcr.io/raffis/mongodb-query-exporter:latest ghcr.io/raffis/mongodb-query-exporter:0.0.0
172+ docker image ls -a
173+ kind load docker-image ghcr.io/raffis/mongodb-query-exporter:0.0.0 --name chart-testing
174+
175+ - name : Run chart-testing (install)
176+ run : ct install --target-branch=master --chart-dirs chart
72177
73178 e2e-tests :
74179 runs-on : ubuntu-latest
0 commit comments