Skip to content

Commit 40b552b

Browse files
committed
ci: generate schema
1 parent 0383102 commit 40b552b

8 files changed

Lines changed: 351 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
on:
3+
push:
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- &checkout
10+
name: Checkout
11+
uses: actions/checkout@v6
12+
- &setup_helm
13+
name: Set up Helm
14+
uses: azure/setup-helm@v5
15+
- name: Lint
16+
run: helm lint .
17+
18+
unittest:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- *checkout
22+
- *setup_helm
23+
- name: Install helm-unittest
24+
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --verify=false
25+
- name: Test
26+
run: helm unittest .
27+
28+
29+
schema:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- *checkout
33+
- *setup_helm
34+
- name: Install helm-values-schema-json plugin
35+
run: helm plugin install https://github.com/losisin/helm-values-schema-json.git --verify=false
36+
- name: Generate values schema json
37+
uses: losisin/helm-values-schema-json-action@v3
38+
with:
39+
values: values.yaml
40+
output: values.schema.json
41+
fail-on-diff: true

.github/workflows/helm-unittest.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ jobs:
2020

2121
- name: Run Helm unit tests
2222
run: helm unittest .
23-

.husky/pre-commit

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
echo 'running helm lint...'
2+
helm lint .
3+
4+
echo 'running helm unittest...'
5+
helm unittest .
6+
7+
echo 'running helm schema generate...'
8+
helm schema -f values.yaml -o values.schema.json

CONTRIBUTING.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ Thank you for your interest in contributing! This guide covers everything you ne
66

77
- [Helm](https://helm.sh/) 3+
88
- [helm-unittest](https://github.com/helm-unittest/helm-unittest) plugin — for running chart unit tests
9-
- [Node.js](https://nodejs.org/) (see `.node-version`) — only needed for commit linting locally
10-
- [mise](https://mise.jdx.dev/) (optional — manages tool versions automatically)
9+
- [helm-values-schema-json](https://github.com/losisin/helm-values-schema-json) plugin — for generating the schema
10+
- [Node.js](https://nodejs.org/) (see `.node-version`) — only needed for commit linting locally and pre commit hooks
11+
- [mise](https://mise.jdx.dev/) — manages tool versions automatically
12+
13+
### Installation
14+
15+
If you install `mise` first you can just run `mise install` and `mise run setup-helm-plugins` and everything will install for you 🙂.
1116

1217
## Development Workflow
1318

@@ -48,15 +53,18 @@ This project uses [helm-unittest](https://github.com/helm-unittest/helm-unittest
4853
### Running tests
4954

5055
```bash
51-
# Install the helm-unittest plugin (one-time)
52-
helm plugin install https://github.com/helm-unittest/helm-unittest.git
56+
# Install the needed helm plugins (one-time)
57+
mise run setup-helm-plugins
5358

5459
# Run all unit tests
5560
helm unittest .
5661

5762
# Lint the chart
5863
helm lint .
5964

65+
# Generate the schema
66+
helm schema
67+
6068
# Render templates locally for inspection
6169
helm template .
6270
```

mise.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ idiomatic_version_file_enable_tools = ["node"] # use .node-version
33

44
[tools]
55
helm = "4.0.4"
6+
7+
[tasks.setup-helm-plugins]
8+
description = "Install all needed helm plugins needed for development"
9+
run = [
10+
"helm plugin install https://github.com/losisin/helm-values-schema-json.git --verify=false",
11+
"helm plugin install https://github.com/helm-unittest/helm-unittest.git --verify=false",
12+
]

package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
"private": true,
33
"description": "Tooling dependencies for CI (semantic-release and commitlint)",
44
"devDependencies": {
5-
"semantic-release": "25.0.3",
6-
"conventional-changelog-conventionalcommits": "9.3.1",
75
"@commitlint/cli": "21.0.1",
8-
"@commitlint/config-conventional": "21.0.1"
6+
"@commitlint/config-conventional": "21.0.1",
7+
"conventional-changelog-conventionalcommits": "9.3.1",
8+
"husky": "^9.1.7",
9+
"semantic-release": "25.0.3"
10+
},
11+
"scripts": {
12+
"prepare": "husky"
913
}
1014
}

0 commit comments

Comments
 (0)