From 5db315a48b43c84c2348a3ca725da767f1bf09fc Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:31 +0200 Subject: [PATCH] Add chart testing workflow --- .github/workflows/charts-lint-test.yaml | 32 +++++++++++++++++++ chart_schema.yaml | 37 ++++++++++++++++++++++ contrib/chart/backstage/Chart.yaml | 2 +- ct.yaml | 8 +++++ lintconf.yaml | 42 +++++++++++++++++++++++++ 5 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/charts-lint-test.yaml create mode 100644 chart_schema.yaml create mode 100644 ct.yaml create mode 100644 lintconf.yaml diff --git a/.github/workflows/charts-lint-test.yaml b/.github/workflows/charts-lint-test.yaml new file mode 100644 index 0000000000..ab73407e9d --- /dev/null +++ b/.github/workflows/charts-lint-test.yaml @@ -0,0 +1,32 @@ +name: Lint and Test Charts + +on: pull_request + +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Fetch history + run: git fetch --prune --unshallow + + - name: Run chart-testing (lint) + id: lint + uses: helm/chart-testing-action@v1.1.0 + with: + command: lint + config: ct.yaml + + - name: Create kind cluster + uses: helm/kind-action@v1.0.0 + # Only build a kind cluster if there are chart changes to test. + if: steps.lint.outputs.changed == 'true' + + - name: Install charts + uses: helm/chart-testing-action@v1.1.0 + if: steps.lint.outputs.changed == 'true' + with: + command: install + config: ct.yaml diff --git a/chart_schema.yaml b/chart_schema.yaml new file mode 100644 index 0000000000..61fc3e14b2 --- /dev/null +++ b/chart_schema.yaml @@ -0,0 +1,37 @@ +name: str() +home: str(required=False) +version: str() +apiVersion: str() +appVersion: any(str(), num(), required=False) +description: str() +keywords: list(str(), required=False) +sources: list(str(), required=False) +maintainers: list(include('maintainer'), required=False) +dependencies: list(include('dependency'), required=False) +icon: str(required=False) +engine: str(required=False) +condition: str(required=False) +tags: str(required=False) +deprecated: bool(required=False) +kubeVersion: str(required=False) +annotations: map(str(), str(), required=False) +type: str(required=False) +--- +maintainer: + name: str() + email: str(required=False) + url: str(required=False) +--- +dependency: + name: str() + version: str() + repository: str() + condition: str(required=False) + tags: list(str(), required=False) + enabled: bool(required=False) + import-values: any(list(str()), list(include('import-value')), required=False) + alias: str(required=False) +--- +import-value: + child: str() + parent: str() diff --git a/contrib/chart/backstage/Chart.yaml b/contrib/chart/backstage/Chart.yaml index 92b5e3e309..7d2a489199 100644 --- a/contrib/chart/backstage/Chart.yaml +++ b/contrib/chart/backstage/Chart.yaml @@ -22,7 +22,7 @@ dependencies: repository: https://charts.bitnami.com/bitnami maintainers: - - name: Martina Iglesias Fernandez + - name: Martina Iglesias Fernández email: martina@roadie.io url: https://roadie.io - name: David Tuite diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000000..53a47c95c2 --- /dev/null +++ b/ct.yaml @@ -0,0 +1,8 @@ +charts: + - contrib/chart/backstage + +validate-maintainers: false +debug: true +target-branch: master +chart-repos: + - bitnami=https://charts.bitnami.com/bitnami diff --git a/lintconf.yaml b/lintconf.yaml new file mode 100644 index 0000000000..b9eb34ff2d --- /dev/null +++ b/lintconf.yaml @@ -0,0 +1,42 @@ +--- +rules: + braces: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + brackets: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + colons: + max-spaces-before: 0 + max-spaces-after: 1 + commas: + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: + require-starting-space: true + min-spaces-from-content: 2 + document-end: disable + document-start: disable # No --- to start a file + empty-lines: + max: 2 + max-start: 0 + max-end: 0 + hyphens: + max-spaces-after: 1 + indentation: + spaces: consistent + indent-sequences: whatever # - list indentation will handle both indentation and without + check-multi-line-strings: false + key-duplicates: enable + line-length: disable # Lines can be any length + new-line-at-end-of-file: enable + new-lines: + type: unix + trailing-spaces: enable + truthy: + level: warning