diff --git a/.github/workflows/chart-testing.yaml b/.github/workflows/chart-testing.yaml index d472ceb..8b7f477 100644 --- a/.github/workflows/chart-testing.yaml +++ b/.github/workflows/chart-testing.yaml @@ -1,9 +1,8 @@ -name: Lint and Test Charts +name: Lint and validate charts on: pull_request jobs: - lint-test: runs-on: ubuntu-latest steps: @@ -28,6 +27,14 @@ jobs: with: node_image: kindest/node:v1.30.2 + - uses: actions/setup-python@v4 + with: + python-version: '3.12' + check-latest: true + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.6.1 + - name: Validate chart template with default values run: | helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ @@ -49,21 +56,13 @@ jobs: run: | helm template ./stack --values ./test-fixtures/values2.yaml | kubectl apply -f - --dry-run=client 2>&1 - - name: Install helm on cluster + - name: Install stack chart on cluster if: steps.list-changed.outputs.changed == 'true' run: | helm repo add argo-helm-charts https://chanzuckerberg.github.io/argo-helm-charts/ helm dep update ./stack helm dependency build ./stack helm install test ./stack --wait --values ./test-fixtures/gha-cluster-values.yaml --debug - - - uses: actions/setup-python@v4 - with: - python-version: '3.12' - check-latest: true - - - name: Set up chart-testing - uses: helm/chart-testing-action@v2.6.1 - name: Run chart-testing (list-changed) id: list-changed @@ -73,10 +72,6 @@ jobs: echo "changed=true" >> "$GITHUB_OUTPUT" fi - - name: Run chart-testing (lint) - if: steps.list-changed.outputs.changed == 'true' - run: ct lint --target-branch ${{ github.event.repository.default_branch }} - - - name: Run chart-testing (install) + - name: Run chart-testing (lint and install) if: steps.list-changed.outputs.changed == 'true' - run: ct install --target-branch ${{ github.event.repository.default_branch }} \ No newline at end of file + run: ct lint-and-install --target-branch ${{ github.event.repository.default_branch }} \ No newline at end of file diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index fb6ade6..c6dcf34 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -1,4 +1,4 @@ -name: Unit testing +name: Unit testing for charts on: pull_request diff --git a/README.md b/README.md index 818bcaa..82ac0e9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ +[![Lint and Test Charts](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml/badge.svg)](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml) +![chart-testing workflow](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml/badge.svg) +![chart-testing branch parameter gha-cluster-test](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml/badge.svg?branch=gha-cluster-test) +![chart-testing event parameter](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/chart-testing.yaml/badge.svg?event=push) +![unittest workflow](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/unittest.yaml/badge.svg) +![unittest branch parameter gha-cluster-test](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/unittest.yaml/badge.svg?branch=gha-cluster-test) +![unittest event parameter](https://github.com/chanzuckerberg/argo-helm-charts/actions/workflows/unittest.yaml/badge.svg?event=push) ### Run tests locally 1. `helm plugin install https://github.com/helm-unittest/helm-unittest.git` 2. from the root: run `helm unittest stack` diff --git a/stack/templates/deployment.yaml b/stack/templates/deployment.yaml index 2e8dc7f..78ea9e1 100644 --- a/stack/templates/deployment.yaml +++ b/stack/templates/deployment.yaml @@ -149,4 +149,4 @@ spec: {{- end }} --- {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/test-fixtures/values.yaml b/test-fixtures/values.yaml index 8fe13e1..f30c5b9 100644 --- a/test-fixtures/values.yaml +++ b/test-fixtures/values.yaml @@ -1,3 +1,8 @@ +<<<<<<< HEAD +services: + service1: + replicaCount: 1 +======= # Service defaults global: replicaCount: 1 @@ -181,4 +186,5 @@ services: {} # - name: sidecar3 # image: sidecar3:latest # - name: sidecar4 - # image: sidecar4:latest \ No newline at end of file + # image: sidecar4:latest +>>>>>>> 205e427911d35d6288b97d11abb1095f1dc04ce0