This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
Migrate pod-init into operator chart, add testing #8
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: Lint Helm charts | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'charts/**' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'charts/**' | |
jobs: | |
find_directories: | |
name: Find changed helm charts | |
runs-on: ubuntu-latest | |
outputs: | |
directories: ${{ steps.find_directories.outputs.build_matrix }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Check out the coredb repo to reuse some actions | |
uses: actions/checkout@v4 | |
with: | |
repository: tembo-io/tembo | |
path: ./.tembo | |
ref: 84664df742ce9774a3029e08111940f9f1fb345e | |
- name: Find directories with Chart.yaml that changed | |
id: find_directories | |
uses: ./.tembo/.github/actions/find-changed-directories | |
with: | |
contains_the_file: Chart.yaml | |
changed_relative_to_branch: ${{ github.base_ref || 'not-a-branch' }} | |
ignore_dirs: ".tembo" | |
lint: | |
name: Lint charts | |
runs-on: ubuntu-latest | |
needs: | |
- find_directories | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.find_directories.outputs.directories) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Helm lint | |
run: helm lint ${{ matrix.path }} | |
lint-ct: | |
name: Lint using chart-testing | |
runs-on: ubuntu-latest | |
needs: | |
- find_directories | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and | |
# yamllint (https://github.com/adrienverge/yamllint) which require Python | |
- name: Set up Python | |
uses: actions/setup-python@v4 # | |
with: | |
python-version: 3.x | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@v2.6.1 | |
- name: Install just | |
uses: extractions/setup-just@v1 | |
- run: just helm-repo | |
# - name: Run chart-testing (list-changed) | |
# id: list-changed | |
# run: | | |
# changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) | |
# if [[ -n "$changed" ]]; then | |
# echo "changed=true" >> $GITHUB_OUTPUT | |
# fi | |
- name: Run chart-testing linter | |
if: steps.list-changed.outputs.changed == 'true' | |
run: ct lint --config ct.yaml | |
test: | |
name: Test using chart-testing | |
runs-on: ubuntu-latest | |
needs: lint-ct | |
# if: needs.lint-ct.outputs.changed == 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: extractions/setup-just@v1 | |
- name: Install kind cluster | |
uses: helm/kind-action@v1.8.0 | |
with: | |
install_only: true | |
- name: Start kind cluster | |
run: just start-kind | |
- name: Run helm chart tests | |
run: ct install --config ct.yaml |