-
Notifications
You must be signed in to change notification settings - Fork 19
86 lines (67 loc) · 2.13 KB
/
lint-and-test.yml
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
name: Lint and Test Charts
on: pull_request
jobs:
lint:
runs-on: ubuntu-latest
container:
image: quay.io/helmpack/chart-testing:v3.7.1
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run chart-testing (lint)
run: |
#!/usr/bin/env bash
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
ct lint
test:
runs-on: ubuntu-latest
container:
image: alpine/helm:3.10.0
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: run tests
run: |
#!/usr/bin/env bash
helm plugin install https://github.com/quintush/helm-unittest
for f in charts/*; do
if [ ! -d "$f" ]; then
continue
fi
echo "Running test on $f"
helm unittest --helm3 "$f"
done
verify-generated-code:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: generate code
run: |
#!/usr/bin/env bash
set -e
# install dependencies
apt update && apt install git wget -y
# install helm-docs
HELM_DOCS_VERSION=1.11.0
HELM_DOCS_URL=https://github.com/norwoodj/helm-docs/releases/download/v${HELM_DOCS_VERSION}/helm-docs_${HELM_DOCS_VERSION}_Linux_x86_64.tar.gz
HELM_DOCS_DIR=/tmp
HELM_DOCS_PKG=${HELM_DOCS_DIR}/helm-docs.tgz
HELM_DOCS_BIN=${HELM_DOCS_DIR}/helm-docs
mkdir -p ${HELM_DOCS_DIR}
echo ${HELM_DOCS_URL}
wget ${HELM_DOCS_URL} --output-document ${HELM_DOCS_PKG}
tar --extract --verbose --file ${HELM_DOCS_PKG} --directory ${HELM_DOCS_DIR}
# regenerate helm docs
${HELM_DOCS_BIN}
# verify that files have not changed
if ! git diff --exit-code; then
echo "generated files are not up to date; please regenerate all code and commit the changes"
exit 1
fi