From c5ca68aa219637945ebf0e299bd5343a02460473 Mon Sep 17 00:00:00 2001 From: Benjamin Huo Date: Sat, 25 Mar 2023 22:51:50 +0800 Subject: [PATCH] Add charts test Signed-off-by: Benjamin Huo --- .github/workflows/lint-test.yaml | 45 ++++++++++++++++++++++++++++++++ charts/ct.yaml | 6 +++++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/lint-test.yaml create mode 100644 charts/ct.yaml diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml new file mode 100644 index 000000000..eb96d096a --- /dev/null +++ b/.github/workflows/lint-test.yaml @@ -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 charts/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 charts/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 charts/ct.yaml \ No newline at end of file diff --git a/charts/ct.yaml b/charts/ct.yaml new file mode 100644 index 000000000..778f234bb --- /dev/null +++ b/charts/ct.yaml @@ -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 \ No newline at end of file