name: Helm unit test on: pull_request: push: branches: - main permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: unit-test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Set up Helm 3.11.1 uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1 with: version: "3.11.1" - name: Download and verify Helm Unit Test Plugin run: | curl -fsSLo "$RUNNER_TEMP/helm-unittest.tgz" https://github.com/helm-unittest/helm-unittest/releases/download/v0.8.2/helm-unittest-linux-amd64-0.8.2.tgz echo "56ab3091e6fa52a7c92ee951def9bed957f295d9ce98483aed404e748d7b3a94 $RUNNER_TEMP/helm-unittest.tgz" | sha256sum -c - - name: Install Helm Unit Test Plugin run: | PLUGIN_DIR="$(helm env HELM_PLUGINS)/helm-unittest" mkdir -p "$PLUGIN_DIR" tar -xzf "$RUNNER_TEMP/helm-unittest.tgz" -C "$PLUGIN_DIR" helm plugin list - name: Run unit tests run: | for chart in helm/litellm-helm helm/litellm; do declared="$(grep -h '^suite:' "$chart"/tests/*.yaml | wc -l | tr -d '[:space:]')" output="$(mktemp)" helm unittest -f 'tests/*.yaml' "$chart" | tee "$output" executed="$(sed -n 's/^Test Suites:.*[[:space:]]\([0-9][0-9]*\) total$/\1/p' "$output")" if [ "$declared" != "$executed" ]; then echo "::error::$chart declares $declared test suites but helm-unittest ran $executed. Suites are being skipped silently, so their assertions never execute." exit 1 fi echo "$chart: all $declared declared test suites ran" done