Merge pull request #21 from fty4/chore/rm-linebreaks-comments #51
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: 'Testing' | |
on: | |
workflow_dispatch: | |
inputs: | |
forceTest: | |
default: true | |
description: Force the running of tests | |
required: true | |
type: boolean | |
push: | |
branches: | |
- main | |
paths: | |
- charts/** | |
pull_request: | |
branches: | |
- main | |
paths: | |
- charts/** | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
changes: | |
name: Determine if charts have changed | |
runs-on: ubuntu-latest | |
outputs: | |
changed: ${{ steps.check_change.outputs.changed }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Chart-Testing | |
uses: helm/chart-testing-action@v2.6.1 | |
- name: Check changes | |
id: check_change | |
run: | | |
changed=$(ct list-changed --config config/ct-config.yaml) | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> "$GITHUB_OUTPUT" | |
fi | |
lint: | |
name: Lint Helm Charts | |
needs: [changes] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4.2.0 | |
with: | |
version: v3.15.1 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
check-latest: true | |
- name: Set up Chart-Testing | |
uses: helm/chart-testing-action@v2.6.1 | |
- name: Run chart-testing (lint) | |
if: ${{ needs.changes.outputs.changed == 'true' || github.event.inputs.forceTest }} | |
run: | | |
ct lint --config config/ct-config.yaml | |
lint-artifacthub: | |
name: Lint Helm Charts with ArtifactHub Linter | |
needs: [changes] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: sh | |
container: | |
image: public.ecr.aws/artifacthub/ah:v1.14.0 | |
options: --user 1001 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run ah lint | |
working-directory: charts | |
run: ah lint | |
test: | |
name: Test Helm Charts | |
needs: [changes, lint, lint-artifacthub] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4.2.0 | |
with: | |
version: v3.15.1 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
check-latest: true | |
- name: Set up Chart-Testing | |
uses: helm/chart-testing-action@v2.6.1 | |
- name: Run chart-testing (lint) | |
if: ${{ needs.changes.outputs.changed == 'true' || github.event.inputs.forceTest }} | |
run: ct lint --config config/ct-config.yaml | |
- name: Run kind to create a Kubernetes cluster | |
if: ${{ needs.changes.outputs.changed == 'true' || github.event.inputs.forceTest }} | |
uses: helm/kind-action@v1 | |
with: | |
config: config/k8s/cluster/kind-config.yaml | |
- name: Run chart-testing (install) | |
if: ${{ needs.changes.outputs.changed == 'true' || github.event.inputs.forceTest }} | |
run: | | |
ct install --config config/ct-config.yaml |