enterprise 5.11 release #208
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright VMware, Inc. | |
# SPDX-License-Identifier: APACHE-2.0 | |
name: 'Helm Unit Tests' | |
on: | |
pull_request: | |
paths: | |
- 'stable/enterprise/Chart.yaml' | |
- 'stable/feeds/Chart.yaml' | |
# Remove all permissions by default | |
permissions: {} | |
jobs: | |
helm-unittests: | |
permissions: | |
contents: read # for helm-unittest to read the chart | |
env: | |
REPO: "${{ github.repository }}" | |
REPO_NAME: "${{ github.event.repository.name }}" | |
TARGET_BRANCH: "${{ github.event.pull_request.base.ref }}" | |
HELM_UNITTEST_VERSION: 0.3.5 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout charts | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
path: ${{ github.repository }} | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Helm | |
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 | |
with: | |
version: v3.8.0 | |
- name: Install helm-unittest | |
run: | | |
helm plugin install https://github.com/helm-unittest/helm-unittest.git --version ${HELM_UNITTEST_VERSION} | |
- run: cd "${REPO}" && git fetch origin ${TARGET_BRANCH} | |
- name: Execute helm-unittests | |
run: | | |
cd "${REPO}" | |
files_changed="$(git diff --name-only origin/${TARGET_BRANCH} | sort | uniq)" | |
# Adding || true to avoid "Process exited with code 1" errors | |
charts_dirs_changed="$(echo "$files_changed" | xargs dirname | grep -o "stable/[^/]*" | sort | uniq || true)" | |
for chart in ${charts_dirs_changed}; do | |
echo "running helm unittest . for ${chart}" | |
pushd "${chart}" | |
helm repo add anchore https://charts.anchore.io/stable | |
helm dep up | |
helm unittest . | |
popd | |
done |