Skip to content

Merge pull request #76 from grafana/petewall/minikube-driver-flag #65

Merge pull request #76 from grafana/petewall/minikube-driver-flag

Merge pull request #76 from grafana/petewall/minikube-driver-flag #65

---
name: Test Helm Test
# yamllint disable-line rule:truthy
on:
push:
branches: [main]
paths: [tools/helm-test/**]
pull_request:
paths: [tools/helm-test/**]
workflow_dispatch:
permissions: {}
jobs:
list-tests:
name: List tests
runs-on: ubuntu-latest
outputs:
localTests: ${{ steps.list_tests.outputs.localTests }}
cloudTests: ${{ steps.list_tests.outputs.cloudTests }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: 'false'
- name: List tests
id: list_tests
working-directory: tools/helm-test/tests
run: |
localTests=()
cloudTests=()
for testPlan in */test-plan.yaml; do
clusterType="$(yq '.cluster.type' "${testPlan}")"
if [[ "${clusterType}" == "kind" ]] || [[ "${clusterType}" == "minikube" ]]; then
localTests+=("$(dirname "${testPlan}")")
else
cloudTests+=("$(dirname "${testPlan}")")
fi
done
echo "localTests=$(printf '%s\n' "${localTests[@]}" | jq --raw-input | jq --slurp --compact-output)" >> "${GITHUB_OUTPUT}"
echo "cloudTests=$(printf '%s\n' "${cloudTests[@]}" | jq --raw-input | jq --slurp --compact-output)" >> "${GITHUB_OUTPUT}"
run-integration-tests:
name: Integration Test
needs: list-tests
runs-on: ubuntu-latest
if: needs.list-tests.outputs.localTests != '[]'
strategy:
matrix:
test: ${{ fromJson(needs.list-tests.outputs.localTests) }}
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: 'false'
path: source
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: 'false'
repository: grafana/helm-chart-toolbox
path: helm-chart-toolbox
- name: Install Flux CLI
uses: fluxcd/flux2/action@8454b02a32e48d775b9f563cb51fdcb1787b5b93 # v2.7.5
- name: Install Kind CLI
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
with:
install_only: true
- name: Install Minikube CLI
uses: medyagh/setup-minikube@e9e035a86bbc3caea26a450bd4dbf9d0c453682e # v0.0.21
with:
start: false
- name: Run test
run: helm-chart-toolbox/tools/helm-test/helm-test "${TEST_DIRECTORY}"
env:
TEST_DIRECTORY: "source/tools/helm-test/tests/${{ matrix.test }}"
DELETE_CLUSTER: true