|
| 1 | +# validate any chart changes under charts directory |
| 2 | +name: Chart Lint |
| 3 | + |
| 4 | +env: |
| 5 | + HELM_VERSION: v3.11.2 |
| 6 | + KIND_VERSION: v0.23.0 |
| 7 | + KIND_NODE_IMAGE: kindest/node:v1.30.0 |
| 8 | + K8S_VERSION: v1.30.0 |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + # Exclude branches created by Dependabot to avoid triggering current workflow |
| 13 | + # for PRs initiated by Dependabot. |
| 14 | + branches-ignore: |
| 15 | + - 'dependabot/**' |
| 16 | + pull_request: |
| 17 | + paths: |
| 18 | + - "charts/**" |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: read |
| 22 | + |
| 23 | +jobs: |
| 24 | + chart-lint-test: |
| 25 | + runs-on: ubuntu-22.04 |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + fetch-depth: 0 |
| 31 | + |
| 32 | + - name: Set up Helm |
| 33 | + uses: azure/setup-helm@v4 |
| 34 | + with: |
| 35 | + version: ${{ env.HELM_VERSION }} |
| 36 | + |
| 37 | + - name: Run chart-testing (template) |
| 38 | + run: | |
| 39 | + helm template --dependency-update ./kwok/charts --debug > /dev/null |
| 40 | +
|
| 41 | + # Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and |
| 42 | + # yamllint (https://github.com/adrienverge/yamllint) which require Python |
| 43 | + - name: Set up Python |
| 44 | + uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version: 3.9 |
| 47 | + check-latest: true |
| 48 | + |
| 49 | + - name: Set up chart-testing |
| 50 | + |
| 51 | + |
| 52 | + - name: Add dependency chart repos |
| 53 | + run: | |
| 54 | + helm repo add bitnami https://charts.bitnami.com/bitnami |
| 55 | +
|
| 56 | + - name: Run chart-testing (list-changed) |
| 57 | + id: list-changed |
| 58 | + run: | |
| 59 | + changed=$( ct list-changed ) |
| 60 | + if [[ -n "$changed" ]]; then |
| 61 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 62 | + fi |
| 63 | +
|
| 64 | + - name: Run chart-testing (lint) |
| 65 | + if: steps.list-changed.outputs.changed == 'true' |
| 66 | + run: ct lint --debug --check-version-increment=false |
| 67 | + |
| 68 | + - name: Create kind cluster |
| 69 | + |
| 70 | + if: steps.list-changed.outputs.changed == 'true' |
| 71 | + with: |
| 72 | + wait: 120s |
| 73 | + version: ${{ env.KIND_VERSION }} |
| 74 | + node_image: ${{ env.KIND_NODE_IMAGE }} |
| 75 | + kubectl_version: ${{ env.K8S_VERSION }} |
| 76 | + |
| 77 | + - name: Run chart-testing (install) |
| 78 | + if: steps.list-changed.outputs.changed == 'true' |
| 79 | + run: ct install --debug --helm-extra-args "--timeout 800s" |
0 commit comments