feat(actions): Add linting and testing

This commit is contained in:
plcnk
2024-08-16 12:17:13 +02:00
parent aa0dd39801
commit d9f460f93a
5 changed files with 65 additions and 0 deletions

2
.github/cr-config.yaml vendored Normal file
View File

@ -0,0 +1,2 @@
generate-release-notes: true
skip-existing: true

2
.github/ct-install-config.yaml vendored Normal file
View File

@ -0,0 +1,2 @@
debug: true
all: true

2
.github/ct-lint-config.yaml vendored Normal file
View File

@ -0,0 +1,2 @@
debug: true
all: true

58
.github/workflows/lint-test.yaml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Lint and Test Charts
on:
push:
branches: [master]
paths:
- "charts/**"
- ".github/workflows/**"
pull_request:
branches: [master]
paths:
- "charts/**"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
- name: Run chart-testing (lint)
run: ct lint --config .github/ct-lint-config.yaml
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v4
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs charts --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
run: |
helm repo add bjw-s https://bjw-s.github.io/helm-charts
ct lint --chart-dirs charts --all
- name: Create kind cluster
uses: helm/kind-action@v1.10.0
- name: Run chart-testing (install)
run: ct install --config .github/ct-install-config.yaml

View File

@ -91,6 +91,7 @@ jobs:
uses: helm/chart-releaser-action@v1.5.0
if: steps.package_charts.outputs.changed_charts != ''
with:
config: .github/cr-config.yaml
skip_packaging: true
env:
CR_TOKEN: ${{ steps.app-token.outputs.token }}