Add support for integration tests in the tests/integration dir (#253)

* Add support for integration tests in the tests/integration dir

Signed-off-by: Kevin Fox <[email protected]>

* Fix split issue and typo

Signed-off-by: Kevin Fox <[email protected]>

---------

Signed-off-by: Kevin Fox <[email protected]>
This commit is contained in:
kfox1111
2024-02-20 08:16:16 -08:00
committed by GitHub
parent 07a1c391b2
commit a4e91c6ba8
2 changed files with 86 additions and 4 deletions
+57 -2
View File
@@ -187,7 +187,7 @@ jobs:
- name: Checkout
uses: actions/[email protected]
- id: set-matrix
- id: set-matrix-example
name: Collect all examples
run: |
examples="$(find examples -maxdepth 2 -type f -name run-tests.sh | xargs -I % dirname %)"
@@ -195,8 +195,17 @@ jobs:
echo "${examples_json}"
echo "examples=$examples_json" >>"$GITHUB_OUTPUT"
- id: set-matrix-integration
name: Collect all integration tests
run: |
integrationtests="$(find tests/integration -maxdepth 2 -type f -name run-tests.sh | xargs -I % dirname %)"
integrationtests_json="$(echo "$integrationtests" | jq -c --slurp --raw-input 'split("\n") | map(select(. != ""))')"
echo "${integrationtests_json}"
echo "integrationtests=$integrationtests_json" >>"$GITHUB_OUTPUT"
outputs:
examples: ${{ steps.set-matrix.outputs.examples }}
examples: ${{ steps.set-matrix-example.outputs.examples }}
integrationtests: ${{ steps.set-matrix-integration.outputs.integrationtests }}
example-test:
runs-on: ubuntu-22.04
@@ -249,6 +258,52 @@ jobs:
fi
${{ matrix.example }}/run-tests.sh
integration-test:
runs-on: ubuntu-22.04
needs:
- lint-chart
- build-matrix
strategy:
fail-fast: false
matrix:
k8s:
- v1.28.0
- v1.27.3
- v1.26.6
integrationtest:
- ${{ fromJson(needs.build-matrix.outputs.integrationtests) }}
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@v5
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 integration
run: |
kubectl create namespace spire-server
helm install -n spire-server spire-crds charts/spire-crds
${{ matrix.integrationtest }}/run-tests.sh
upgrade-test:
runs-on: ubuntu-22.04