Skip to content

Update test

Update test #15

Workflow file for this run

name: Lint and Test Charts
on: pull_request
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v4
- uses: actions/setup-python@v5
with:
python-version: 3.7
- name: Install helm-unittest plugin
run: helm plugin install https://github.com/helm-unittest/helm-unittest
- name: Install chart-testing
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Changed charts: $changed"
echo "changed_charts=$changed" >> $GITHUB_OUTPUT
fi
- name: Add repositories
run: |
for dir in $(ls -d charts/*/); do
helm dependency list $dir 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
done
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml
- name: Run helm-unittest on changed charts
if: steps.list-changed.outputs.changed == 'true'
run: |
IFS=' ' read -ra CHART_ARRAY <<< "${{ steps.list-changed.outputs.changed_charts }}"
for chart in "${CHART_ARRAY[@]}"; do
echo "Testing chart: $chart"
cd "charts/$chart"
helm unittest . || exit 1
cd $GITHUB_WORKSPACE
done
- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'
- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --config ct.yaml