Skip to content

Add chart-testing workflow #6

Add chart-testing workflow

Add chart-testing workflow #6

Workflow file for this run

name: chart-workflow
on:
workflow_call:
pull_request:
jobs:
chart-testing:
runs-on: [ubuntu-latest]
container:
image: quay.io/helmpack/chart-testing:v3.11.0
options: --user 1001
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch chart dependencies
run: |
for chart in $(cat charts-to-test); do
helm dependency update "$chart" >/dev/null
done
shell: bash
- name: Run Helm Chart Testing
run: |
ct lint 2>&1 | tee chart-testing-output-ct-lint.txt
- name: Install dependencies
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest.git
- name: Assemble list of chart directories to test
run: |
tr ' ' '\n' <<< "${{ inputs.charts }}" | grep -v '^$' > charts-to-test || true
find . -type f -name 'Chart.yaml' -exec dirname {} \; > all-charts
[ -z "${{ inputs.charts }}" ] && mv all-charts charts-to-test || true
shell: bash
- name: Run Helm Unit Test
run: |
helm unittest $(cat charts-to-test) 2>&1 | tee chart-testing-output-helm-unittest.txt
- uses: mshick/add-pr-comment@v2
with:
preformatted: true
message-id: "${{ github.event.number }}"
message-path: chart-testing-output-*.txt