|
| 1 | +--- |
| 2 | +name: Lint & Test helm chart |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - develop |
| 9 | + - feature/** |
| 10 | + - release/** |
| 11 | + - hotfix/** |
| 12 | + paths: |
| 13 | + - 'charts/**' |
| 14 | + push: |
| 15 | + branches: |
| 16 | + - main |
| 17 | + - develop |
| 18 | + - feature/** |
| 19 | + - release/** |
| 20 | + - hotfix/** |
| 21 | + paths: |
| 22 | + - 'charts/**' |
| 23 | + |
| 24 | +concurrency: |
| 25 | + group: '${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' |
| 26 | + cancel-in-progress: true |
| 27 | + |
| 28 | +jobs: |
| 29 | + set-charts: |
| 30 | + # Required permissions |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + pull-requests: read |
| 34 | + outputs: |
| 35 | + charts: ${{ steps.charts.outputs.changes }} |
| 36 | + name: "Set Charts" |
| 37 | + runs-on: [ubuntu-latest] |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + - uses: dorny/paths-filter@v2 |
| 41 | + id: charts |
| 42 | + with: |
| 43 | + base: ${{ github.ref_name }} |
| 44 | + filters: | |
| 45 | + sysdig-mcp: |
| 46 | + - 'charts/sysdig-mcp/**' |
| 47 | + lint-charts: |
| 48 | + needs: set-charts |
| 49 | + name: Lint new helm charts |
| 50 | + runs-on: [ubuntu-latest] |
| 51 | + strategy: |
| 52 | + matrix: |
| 53 | + chart: ${{ fromJSON(needs.set-charts.outputs.charts) }} |
| 54 | + # When set to true, GitHub cancels all in-progress jobs if any matrix job fails. |
| 55 | + fail-fast: false |
| 56 | + # The maximum number of jobs that can run simultaneously |
| 57 | + max-parallel: 3 |
| 58 | + steps: |
| 59 | + |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + with: |
| 62 | + fetch-depth: 0 |
| 63 | + |
| 64 | + - name: Set up Helm |
| 65 | + uses: azure/setup-helm@v4 |
| 66 | + with: |
| 67 | + version: v3.5.0 |
| 68 | + |
| 69 | + - uses: actions/setup-python@v4 |
| 70 | + with: |
| 71 | + python-version: '3.10' |
| 72 | + check-latest: true |
| 73 | + |
| 74 | + - name: Set up chart-testing |
| 75 | + uses: helm/chart-testing-action@v2.6.1 |
| 76 | + |
| 77 | + - name: Run chart-testing (list-changed) |
| 78 | + id: list-changed |
| 79 | + run: | |
| 80 | + changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }} --chart-dirs charts,charts/${{ matrix.chart }}) |
| 81 | + if [[ -n "$changed" ]]; then |
| 82 | + echo "changed=true" >> "$GITHUB_OUTPUT" |
| 83 | + fi |
| 84 | +
|
| 85 | + - name: Run chart-testing (lint) |
| 86 | + if: steps.list-changed.outputs.changed == 'true' |
| 87 | + run: ct lint --target-branch ${{ github.event.repository.default_branch }} --chart-dirs charts/${{ matrix.chart }} |
| 88 | + |
| 89 | + - name: Create kind cluster |
| 90 | + if: steps.list-changed.outputs.changed == 'true' |
| 91 | + uses: helm/kind-action@v1.12.0 |
| 92 | + |
| 93 | + - name: Run chart-testing (install) |
| 94 | + if: steps.list-changed.outputs.changed == 'true' |
| 95 | + run: ct install --target-branch ${{ github.event.repository.default_branch }} --chart-dirs charts/${{ matrix.chart }} |
0 commit comments