|
22 | 22 | - 'charts/nextcloud/templates/**' |
23 | 23 |
|
24 | 24 | lint: |
25 | | - runs-on: ubuntu-22.04 |
| 25 | + runs-on: ubuntu-latest-low |
26 | 26 | needs: changes |
27 | 27 | if: needs.changes.outputs.src != 'false' |
28 | 28 | steps: |
@@ -56,10 +56,32 @@ jobs: |
56 | 56 | if: steps.list-changed.outputs.changed == 'true' |
57 | 57 | run: ct lint --target-branch ${{ github.event.repository.default_branch }} |
58 | 58 |
|
59 | | - test-internal-database: |
| 59 | + run-tests: |
60 | 60 | runs-on: ubuntu-22.04 |
61 | 61 | needs: [changes, lint] |
| 62 | + # only run this job if there are helm chart file changes |
62 | 63 | if: needs.changes.outputs.src != 'false' |
| 64 | + strategy: |
| 65 | + # continue with all the other jobs even if one fails |
| 66 | + fail-fast: false |
| 67 | + matrix: |
| 68 | + # each item in this list is a job with an isolated test VM |
| 69 | + test_cases: |
| 70 | + # test the plain helm chart with nothing changed |
| 71 | + - name: 'Default - no custom values' |
| 72 | + |
| 73 | + # test the helm chart with postgresql subchart enabled |
| 74 | + - name: PostgreSQL Enabled |
| 75 | + helm_args: '--helm-extra-set-args "--set=postgresql.enabled=true --set=postgresql.global.postgresql.auth.password=testing123456 --set=internalDatabase.enabled=false --set=externalDatabase.enabled=True --set=externalDatabase.type=postgresql --set=externalDatabase.password=testing12345"' |
| 76 | + |
| 77 | + # test the helm chart with nginx container enabled |
| 78 | + - name: Nginx Enabled |
| 79 | + helm_args: '--helm-extra-set-args "--set=image.flavor=fpm --set=nginx.enabled=true"' |
| 80 | + |
| 81 | + # test the helm chart with horizontal pod autoscaling enabled |
| 82 | + - name: Horizontal Pod Autoscaling Enabled |
| 83 | + helm_args: '--helm-extra-set-args "--set=hpa.enabled=true --set=hpa.minPods=2 --set=hpa.maxPods=3 --set=hpa.targetCPUUtilizationPercentage=75"' |
| 84 | + |
63 | 85 | steps: |
64 | 86 | - name: Checkout |
65 | 87 | uses: actions/checkout@v4 |
@@ -90,48 +112,15 @@ jobs: |
90 | 112 | uses: helm/kind-action@v1.10.0 |
91 | 113 | if: steps.list-changed.outputs.changed == 'true' |
92 | 114 |
|
93 | | - - name: Run chart-testing (install) |
| 115 | + - name: Run chart-testing (install ${{ matrix.test_cases.name }}) |
94 | 116 | id: install |
95 | 117 | if: steps.list-changed.outputs.changed == 'true' |
96 | | - run: ct install --target-branch ${{ github.event.repository.default_branch }} |
| 118 | + run: ct install --target-branch ${{ github.event.repository.default_branch }} ${{ matrix.test_cases.helm_args }} |
97 | 119 |
|
98 | | - test-postgresql-database: |
99 | | - runs-on: ubuntu-22.04 |
100 | | - needs: [changes, lint] |
101 | | - if: needs.changes.outputs.src != 'false' |
| 120 | + summary: |
| 121 | + runs-on: ubuntu-latest-low |
| 122 | + needs: [changes, run-tests] |
| 123 | + if: always() |
102 | 124 | steps: |
103 | | - - name: Checkout |
104 | | - uses: actions/checkout@v4 |
105 | | - with: |
106 | | - fetch-depth: 0 |
107 | | - |
108 | | - - name: Install Helm |
109 | | - uses: azure/setup-helm@v4 |
110 | | - with: |
111 | | - version: v3.14.4 |
112 | | - |
113 | | - - name: Add dependency chart repos |
114 | | - run: | |
115 | | - helm repo add bitnami https://charts.bitnami.com/bitnami |
116 | | -
|
117 | | - - name: Set up chart-testing |
118 | | - uses: helm/chart-testing-action@v2.6.1 |
119 | | - |
120 | | - - name: Run chart-testing (list-changed) |
121 | | - id: list-changed |
122 | | - run: | |
123 | | - changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) |
124 | | - if [[ -n "$changed" ]]; then |
125 | | - echo "changed=true" >> "$GITHUB_OUTPUT" |
126 | | - fi |
127 | | -
|
128 | | - - name: Create kind cluster |
129 | | - uses: helm/kind-action@v1.10.0 |
130 | | - if: steps.list-changed.outputs.changed == 'true' |
131 | | - |
132 | | - - name: Run chart-testing (install) |
133 | | - id: install |
134 | | - if: steps.list-changed.outputs.changed == 'true' |
135 | | - run: | |
136 | | - ct install --target-branch ${{ github.event.repository.default_branch }} \ |
137 | | - --helm-extra-set-args "--set=postgresql.enabled=true --set=postgresql.global.postgresql.auth.password=testing123456 --set=internalDatabase.enabled=false --set=externalDatabase.enabled=True --set=externalDatabase.type=postgresql --set=externalDatabase.password=testing123456" |
| 125 | + - name: Summary |
| 126 | + run: if ${{ needs.changes.outputs.src != 'false' && needs.run-tests.result != 'success' }}; then exit 1; fi |
0 commit comments