@rophy123/helmtest 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/docker-publish.yml +78 -0
- package/.github/workflows/npm-publish.yml +34 -0
- package/CLAUDE.md +10 -0
- package/CONTRIBUTING.md +12 -0
- package/README.md +6 -2
- package/bin/helmtest +2 -3
- package/bin/setup.js +2 -0
- package/package.json +16 -4
- package/Makefile +0 -13
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: CI and Docker Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
REGISTRY: ghcr.io
|
|
11
|
+
IMAGE_NAME: ${{ github.repository }}
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout source
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Node.js
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: '22'
|
|
24
|
+
cache: 'npm'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm ci
|
|
28
|
+
|
|
29
|
+
- name: Run linter
|
|
30
|
+
run: npm run lint --if-present
|
|
31
|
+
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: npm test
|
|
34
|
+
|
|
35
|
+
build-and-push:
|
|
36
|
+
needs: test
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
39
|
+
permissions:
|
|
40
|
+
contents: read
|
|
41
|
+
packages: write
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- name: Checkout source
|
|
45
|
+
uses: actions/checkout@v4
|
|
46
|
+
|
|
47
|
+
- name: Set up Docker Buildx
|
|
48
|
+
uses: docker/setup-buildx-action@v3
|
|
49
|
+
|
|
50
|
+
- name: Login to GitHub Container Registry
|
|
51
|
+
uses: docker/login-action@v3
|
|
52
|
+
with:
|
|
53
|
+
registry: ${{ env.REGISTRY }}
|
|
54
|
+
username: ${{ github.actor }}
|
|
55
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
56
|
+
|
|
57
|
+
- name: Get package version
|
|
58
|
+
id: pkg
|
|
59
|
+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
|
60
|
+
|
|
61
|
+
- name: Extract metadata for Docker
|
|
62
|
+
id: meta
|
|
63
|
+
uses: docker/metadata-action@v5
|
|
64
|
+
with:
|
|
65
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
66
|
+
tags: |
|
|
67
|
+
type=raw,value=latest
|
|
68
|
+
type=raw,value=${{ steps.pkg.outputs.version }}
|
|
69
|
+
|
|
70
|
+
- name: Build and push Docker image
|
|
71
|
+
uses: docker/build-push-action@v5
|
|
72
|
+
with:
|
|
73
|
+
context: .
|
|
74
|
+
file: ./Dockerfile
|
|
75
|
+
platforms: linux/amd64,linux/arm64
|
|
76
|
+
push: true
|
|
77
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
78
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: NPM Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout source
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Setup Node.js
|
|
19
|
+
uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version: '24'
|
|
22
|
+
cache: 'npm'
|
|
23
|
+
|
|
24
|
+
- name: Install Helm
|
|
25
|
+
uses: azure/setup-helm@v4
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: npm ci
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: npm test
|
|
32
|
+
|
|
33
|
+
- name: Publish to npm
|
|
34
|
+
run: npm publish --access public
|
package/CLAUDE.md
ADDED
package/CONTRIBUTING.md
ADDED
package/README.md
CHANGED
|
@@ -64,9 +64,13 @@ npm install -g @rophy123/helmtest jest
|
|
|
64
64
|
|
|
65
65
|
...and then you can write unit tests under `tests/` dir of your chart project without the need for package.json
|
|
66
66
|
|
|
67
|
-
A docker image
|
|
67
|
+
A docker image is available which includes everything to run unit tests:
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
```bash
|
|
70
|
+
docker run -v $(pwd):/workspace ghcr.io/rophy/helmtest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
See [exampleChart/tests](./exampleChart/tests) for example tests.
|
|
70
74
|
|
|
71
75
|
## API Spec
|
|
72
76
|
|
package/bin/helmtest
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
|
-
const helmtest = require('../lib/helmtest');
|
|
5
4
|
|
|
6
5
|
let jest;
|
|
7
6
|
|
|
@@ -16,8 +15,6 @@ try {
|
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
globalThis.helmtest = helmtest;
|
|
20
|
-
|
|
21
18
|
jest.run([
|
|
22
19
|
'--testMatch',
|
|
23
20
|
'**/*.js',
|
|
@@ -25,4 +22,6 @@ jest.run([
|
|
|
25
22
|
__dirname,
|
|
26
23
|
'--roots',
|
|
27
24
|
path.join(process.cwd(), 'tests'),
|
|
25
|
+
'--setupFilesAfterEnv',
|
|
26
|
+
path.join(__dirname, '/setup.js')
|
|
28
27
|
]);
|
package/bin/setup.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rophy123/helmtest",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"description": "Write unit tests against your helm charts using JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,19 +14,22 @@
|
|
|
14
14
|
"url": "git+https://github.com/rophy/helmtest.git"
|
|
15
15
|
},
|
|
16
16
|
"author": "Rophy Tsai <rophy@users.noreply.github.com>",
|
|
17
|
+
"contributors": [
|
|
18
|
+
"Rick Lin <932364+pchikoian@users.noreply.github.com>"
|
|
19
|
+
],
|
|
17
20
|
"license": "MIT",
|
|
18
21
|
"bugs": {
|
|
19
22
|
"url": "https://github.com/rophy/helmtest/issues"
|
|
20
23
|
},
|
|
21
24
|
"homepage": "https://github.com/rophy/helmtest#readme",
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"debug": "^4.
|
|
26
|
+
"debug": "^4.4.0",
|
|
24
27
|
"js-yaml": "^4.1.0"
|
|
25
28
|
},
|
|
26
29
|
"devDependencies": {
|
|
27
|
-
"eslint": "^8.
|
|
30
|
+
"eslint": "^8.57.0",
|
|
28
31
|
"eslint-config-google": "^0.14.0",
|
|
29
|
-
"jest": "^29.
|
|
32
|
+
"jest": "^29.7.0"
|
|
30
33
|
},
|
|
31
34
|
"peerDependenciesMeta": {
|
|
32
35
|
"jest": {
|
|
@@ -35,5 +38,14 @@
|
|
|
35
38
|
},
|
|
36
39
|
"engines": {
|
|
37
40
|
"node": ">=16.0.0"
|
|
41
|
+
},
|
|
42
|
+
"directories": {
|
|
43
|
+
"lib": "lib",
|
|
44
|
+
"test": "tests"
|
|
45
|
+
},
|
|
46
|
+
"jest": {
|
|
47
|
+
"testMatch": [
|
|
48
|
+
"<rootDir>/tests/**/*.test.js"
|
|
49
|
+
]
|
|
38
50
|
}
|
|
39
51
|
}
|
package/Makefile
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
.PHONY: help test
|
|
2
|
-
|
|
3
|
-
help: ## Show this help.
|
|
4
|
-
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
|
|
5
|
-
|
|
6
|
-
test: ## Run unit tests.
|
|
7
|
-
docker run -t --rm -e DEBUG=helmtest -v `pwd`:/workspace rophy/helmtest
|
|
8
|
-
|
|
9
|
-
build: ## Build docker image.
|
|
10
|
-
docker build -t rophy/helmtest .
|
|
11
|
-
|
|
12
|
-
dev: ## Create a dev container shell
|
|
13
|
-
docker run -it --rm -e DEBUG=helmtest -v `pwd`:/workspace rophy/helmtest bash
|