Skip to content

Commit

Permalink
Add job to test helm-docs (#780)
Browse files Browse the repository at this point in the history
* clean up ci jobs

Signed-off-by: cpanato <[email protected]>

* update dependabot config

Signed-off-by: cpanato <[email protected]>

* add makefile and job to check helm docs

Signed-off-by: cpanato <[email protected]>

---------

Signed-off-by: cpanato <[email protected]>
  • Loading branch information
cpanato authored Jul 18, 2024
1 parent 09db4df commit 2e3eda1
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
update-types:
- "minor"
- "patch"
29 changes: 29 additions & 0 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check Helm Docs

on:
pull_request:
paths:
- "charts/**"

jobs:
readme:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Run Helm Docs and check the outcome
run: |
make docs
exit_code=$(git diff --exit-code)
exit ${exit_code}
- name: Print a comment in case of failure
run: |
echo "The README.md files are not up to date.
Please, run \"make docs\" before pushing."
exit 1
if: |
failure() && github.event.pull_request.head.repo.full_name == github.repository
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ jobs:
- name: Set up Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: v3.10.3

- name: Add dependency chart repos
run: |
Expand Down Expand Up @@ -80,4 +78,4 @@ jobs:
cosign sign "ghcr.io/${GITHUB_REPOSITORY}/${chart_name}@${digest}"
done
env:
COSIGN_YES: true
COSIGN_YES: true
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ jobs:

- name: Set up Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: v3.10.3

- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: 3.7
python-version: '3.x'
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
Expand Down
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
DOCS_IMAGE_VERSION="v1.14.2"

CHART_TESTING_IMAGE_VERSION="v3.10.1"

# Charts's path relative to the current directory.
CHARTS := $(wildcard ./charts/*)

CHARTS_NAMES := $(notdir $(CHARTS))

.PHONY: lint
lint: helm-deps-update $(addprefix lint-, $(CHARTS_NAMES))

lint-%:
@docker run \
-it \
-e HOME=/home/ct \
--mount type=tmpfs,destination=/home/ct \
--workdir=/data \
--volume $$(pwd):/data \
-u $$(id -u) \
quay.io/helmpack/chart-testing:$(CHART_TESTING_IMAGE_VERSION) \
ct lint --config ./ct.yaml --charts ./charts/$*

.PHONY: docs
docs: $(addprefix docs-, $(CHARTS_NAMES))

docs-%:
@docker run \
--rm \
--workdir=/helm-docs \
--volume "$$(pwd):/helm-docs" \
-u $$(id -u) \
jnorwood/helm-docs:$(DOCS_IMAGE_VERSION) \
helm-docs -c ./charts/$* -t ./README.md.gotmpl -o ./README.md

.PHONY: helm-deps-update
helm-deps-update: $(addprefix helm-deps-update-, $(CHARTS_NAMES))

helm-deps-update-%:
helm dependency update ./charts/$*

0 comments on commit 2e3eda1

Please sign in to comment.