Skip to content

Add chart-testing workflow #3

Add chart-testing workflow

Add chart-testing workflow #3

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: Run Helm Chart Testing
run: |
ct lint > ct-lint-output.txt
- uses: mshick/add-pr-comment@v2
with:
preformatted: true
message-id: "${{ github.event.number }}"
message-path: ct-lint-output.txt
helm-unit-test:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/[email protected]
- 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: Fetch chart dependencies
run: |
for chart in $(cat charts-to-test); do
helm dependency update "$chart" >/dev/null
done
shell: bash
- name: Run Helm Unit Test
run: |
helm unittest $(cat charts-to-test) > helm-unittest-output.txt
- uses: mshick/add-pr-comment@v2
with:
preformatted: true
message-id: "${{ github.event.number }}"
message-path: helm-unittest-output.txt