Add back tests for examples

Signed-off-by: Marco Franssen <[email protected]>
This commit is contained in:
Marco Franssen
2023-07-19 22:49:22 +02:00
parent 4b4cef1eae
commit 54ed71f969
11 changed files with 238 additions and 14 deletions
+62 -2
View File
@@ -12,6 +12,7 @@ on:
- '.github/tests/**/*.sh'
- '.github/tests/**/*.json'
- 'examples/**/*.yaml'
- 'examples/**/*.sh'
- 'tests/**/*'
- 'helm-docs.sh'
@@ -22,6 +23,7 @@ concurrency:
env:
HELM_VERSION: v3.12.0
PYTHON_VERSION: 3.11.3
KIND_VERSION: v0.19.0
CHART_TESTING_VERSION: v3.8.0
jobs:
@@ -160,7 +162,7 @@ jobs:
uses: helm/[email protected]
# Only build a kind cluster if there are chart changes to test.
with:
version: v0.19.0
version: ${{ env.KIND_VERSION }}
node_image: kindest/node:${{ matrix.k8s }}
config: .github/kind/conf/kind-config.yaml
verbosity: 1
@@ -172,9 +174,67 @@ jobs:
- name: Run chart-testing (install)
run: |
ct install --config ct.yaml \
--target-branch ${{ github.base_ref }} \
--target-branch ${{ github.base_ref }}
- name: Test summary
if: always()
run: ./post-install.sh
working-directory: .github/tests
build-matrix:
name: Build matrix
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]
- id: set-matrix
name: Collect all examples
run: |
examples="$(find examples -maxdepth 2 -type f -name run-tests.sh | xargs -I % dirname %)"
examples_json="$(echo "$examples" | jq -c --slurp --raw-input 'split("\n") | map(select(. != ""))')"
echo "${examples_json}"
echo "examples=$examples_json" >>"$GITHUB_OUTPUT"
outputs:
examples: ${{ steps.set-matrix.outputs.examples }}
example-test:
runs-on: ubuntu-22.04
needs:
- lint-chart
- build-matrix
strategy:
fail-fast: false
matrix:
example:
- ${{ fromJson(needs.build-matrix.outputs.examples) }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Helm
uses: azure/[email protected]
with:
version: ${{ env.HELM_VERSION }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Create kind cluster
uses: helm/[email protected]
# Only build a kind cluster if there are chart changes to test.
with:
version: ${{ env.KIND_VERSION }}
node_image: kindest/node:v1.26.4
config: .github/kind/conf/kind-config.yaml
verbosity: 1
- name: Install and test example
run: ${{ matrix.example }}/run-tests.sh