Skip to content

Commit

Permalink
Add charts test
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Huo <benjamin@kubesphere.io>
  • Loading branch information
benjaminhuo committed Mar 25, 2023
1 parent 81bc0dc commit a691845
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint and Test Charts

on: pull_request

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.6.3

# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.1.0

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs charts/fluent-operator --config ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --chart-dirs charts/fluent-operator --config ct.yaml

- name: Create kind cluster
uses: helm/kind-action@v1.2.0
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install --chart-dirs charts/fluent-operator --config ct.yaml
6 changes: 6 additions & 0 deletions tests/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# See https://github.com/helm/chart-testing#configuration
remote: origin
chart-dirs:
- charts/fluent-operator
helm-extra-args: --timeout=500s
target-branch: master

0 comments on commit a691845

Please sign in to comment.