-
Notifications
You must be signed in to change notification settings - Fork 593
150 lines (126 loc) · 4.74 KB
/
Copy pathtest-lint.yaml
File metadata and controls
150 lines (126 loc) · 4.74 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Lint and Test Charts
# yamllint disable-line rule:truthy
on:
workflow_call:
workflow_dispatch:
pull_request:
branches:
- master
paths:
- 'charts/plex-media-server/**'
env:
KUBECONFORM_VERSION: v0.6.7
KUBE_VERSION: 1.33.0
jobs:
chart-lint:
name: Chart / lint
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: 3.x
check-latest: true
- name: Set up Helm
uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0
with:
version: 3.18.4 # renovate: datasource=github-releases depName=helm packageName=helm/helm
- name: Set up Helm Chart Testing
uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2.7.0
with:
version: v3.14.0 # renovate: datasource=github-releases depName=chart-testing packageName=helm/chart-testing
yamale_version: 6.0.0 # renovate: datasource=github-releases depName=yamale packageName=23andMe/Yamale
- name: Set up Artifact Hub
run: |
curl --fail \
--location https://github.com/artifacthub/hub/releases/download/v1.21.0/ah_1.21.0_linux_amd64.tar.gz \
--output /tmp/ah.tar.gz
echo "48d6b87b60baf4ee8fd5efbfec3bf5fb3ca783ab3f1dab625e64332b95df2a84 /tmp/ah.tar.gz" | shasum --check
sudo tar --extract --file /tmp/ah.tar.gz --directory /usr/local/bin ah
- name: Set up helm-docs
uses: gabe565/setup-helm-docs-action@d5c35bdc9133cfbea3b671acadf50a29029e87c2 # v1.0.4
- name: Checkout source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .github/linters/ct.yaml)
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Lint chart
if: steps.list-changed.outputs.changed == 'true'
run: |
ct lint --config .github/linters/ct.yaml
ah lint --path charts/plex-media-server
- name: Lint Helm docs
if: steps.list-changed.outputs.changed == 'true'
shell: bash
run: |
helm-docs --chart-search-root charts
git diff --exit-code charts/plex-media-server/README.md
- name: Cache kubeconform
id: cache-kubeconform
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
env:
cache-name: cache-kubeconform
with:
path: bin
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.KUBECONFORM_VERSION }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
# yamllint disable rule:line-length
- name: Install kubeconform
if: steps.cache-kubeconform.outputs.cache-hit != 'true'
run: |
mkdir -p "$GITHUB_WORKSPACE/bin"
curl -sSLO \
"https://github.com/yannh/kubeconform/releases/download/${{ env.KUBECONFORM_VERSION }}/kubeconform-linux-amd64.tar.gz" &&
tar -xf "kubeconform-linux-amd64.tar.gz" &&
rm "kubeconform-linux-amd64.tar.gz" &&
mv kubeconform "$GITHUB_WORKSPACE/bin"
# yamllint enable rule:line-length
- name: Setup PATH
run: |
echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH"
- name: Run kubeconform
id: kubeconform
if: steps.list-changed.outputs.changed == 'true'
run: |
app=plex-media-server
helm template pms "charts/${app}" \
--namespace example \
--values "charts/${app}/ci/ci-values.yaml" \
--set 'pms.gpu.nvidia.enabled=true' |
kubeconform \
-kubernetes-version=${{ env.KUBE_VERSION }} \
-schema-location default \
-strict \
-output tap
chart-test:
name: Chart / test
runs-on: ubuntu-latest
needs:
- chart-lint
steps:
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: 3.x
check-latest: true
- name: Set up Helm
uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0
- name: Set up Helm Chart Testing
uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2.7.0
- name: Checkout source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Create kind cluster
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
- name: Run chart-testing (install)
run: ct install --config .github/linters/ct.yaml