Skip to content

test: add helm-unittest tests for all chart templates #15

test: add helm-unittest tests for all chart templates

test: add helm-unittest tests for all chart templates #15

Workflow file for this run

name: Release Helm chart
on:
push:
branches: [main]
tags: ['v*']
paths:
- 'charts/**'
- '.github/workflows/helm.yml'
workflow_dispatch:
jobs:
test:
name: Lint and unit test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Install Helm
run: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Install helm-unittest plugin
run: helm plugin install https://github.com/helm-unittest/helm-unittest
- name: Lint
run: helm lint charts/envoy-router
- name: Unit tests
run: helm unittest charts/envoy-router
oci:
name: Publish to GHCR (OCI)
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- name: Install Helm
run: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set chart version from git tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION="${GITHUB_REF_NAME#v}"
sed -i "s/^version:.*/version: ${VERSION}/" charts/envoy-router/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"${GITHUB_REF_NAME}\"/" charts/envoy-router/Chart.yaml
- name: Package and push
run: |
helm package charts/envoy-router --destination /tmp/helm
for tgz in /tmp/helm/envoy-router-*.tgz; do
helm push "$tgz" oci://ghcr.io/${{ github.repository_owner }}/charts
done
- name: Summary
run: |
VERSION=$(grep '^version:' charts/envoy-router/Chart.yaml | awk '{print $2}')
REGISTRY="oci://ghcr.io/${{ github.repository_owner }}/charts"
echo "## Helm chart published" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| | |" >> "$GITHUB_STEP_SUMMARY"
echo "|---|---|" >> "$GITHUB_STEP_SUMMARY"
echo "| **Chart** | \`envoy-router\` |" >> "$GITHUB_STEP_SUMMARY"
echo "| **Version** | \`${VERSION}\` |" >> "$GITHUB_STEP_SUMMARY"
echo "| **Registry** | \`${REGISTRY}\` |" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```bash' >> "$GITHUB_STEP_SUMMARY"
echo "helm install envoy-router ${REGISTRY}/envoy-router --version ${VERSION}" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"