Helm - Lint and Test Charts #136
Workflow file for this run
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
name: Helm - Lint and Test Charts | |
on: | |
merge_group: | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
helm-chart-check: | |
# See https://runs-on.com/runners/linux/ | |
runs-on: [runs-on,runner=8cpu-linux-x64,hdd=256,"run-id=${{ github.run_id }}"] | |
# fetch-depth 0 is required for helm/chart-testing-action | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4.2.0 | |
with: | |
version: v3.14.4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: | | |
backend/requirements/default.txt | |
backend/requirements/dev.txt | |
backend/requirements/model_server.txt | |
- run: | | |
python -m pip install --upgrade pip | |
pip install --retries 5 --timeout 30 -r backend/requirements/default.txt | |
pip install --retries 5 --timeout 30 -r backend/requirements/dev.txt | |
pip install --retries 5 --timeout 30 -r backend/requirements/model_server.txt | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@v2.6.1 | |
# even though we specify chart-dirs in ct.yaml, it isn't used by ct for the list-changed command... | |
- name: Run chart-testing (list-changed) | |
id: list-changed | |
run: | | |
echo "default_branch: ${{ github.event.repository.default_branch }}" | |
changed=$(ct list-changed --remote origin --target-branch ${{ github.event.repository.default_branch }} --chart-dirs deployment/helm/charts) | |
echo "list-changed output: $changed" | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> "$GITHUB_OUTPUT" | |
fi | |
# lint all charts if any changes were detected | |
- name: Run chart-testing (lint) | |
if: steps.list-changed.outputs.changed == 'true' | |
run: ct lint --config ct.yaml --all | |
# the following would lint only changed charts, but linting isn't expensive | |
# run: ct lint --config ct.yaml --target-branch ${{ github.event.repository.default_branch }} | |
- name: Create kind cluster | |
if: steps.list-changed.outputs.changed == 'true' | |
uses: helm/kind-action@v1.10.0 | |
- name: Run chart-testing (install) | |
if: steps.list-changed.outputs.changed == 'true' | |
run: ct install --all --helm-extra-set-args="--set=nginx.enabled=false" --debug --config ct.yaml | |
# the following would install only changed charts, but we only have one chart so | |
# don't worry about that for now | |
# run: ct install --target-branch ${{ github.event.repository.default_branch }} |