-
Notifications
You must be signed in to change notification settings - Fork 106
76 lines (66 loc) · 2.07 KB
/
integration-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
name: Integration Test
# yamllint disable-line rule:truthy
on:
push:
branches: ["main"]
paths:
- 'charts/**'
- '!charts/k8s-monitoring-v1/**'
pull_request:
paths:
- 'charts/**'
- '!charts/k8s-monitoring-v1/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
list-tests:
name: List tests
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.list_tests.outputs.tests }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: List tests
id: list_tests
run: |
tests=$(ls charts/k8s-monitoring/tests/integration)
echo "Tests: ${tests}"
echo "tests=$(echo "${tests}" | jq --raw-input --slurp --compact-output 'split("\n") | map(select(. != ""))')" >> "${GITHUB_OUTPUT}"
run-tests:
name: Integration Test
needs: list-tests
runs-on: ubuntu-latest
strategy:
matrix:
test: ${{ fromJson(needs.list-tests.outputs.tests) }}
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
- name: Setup Kind CLI
uses: helm/kind-action@v1
with:
install_only: true
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
- name: Read special test dependencies
id: read_deps
run: |
if [ -f "charts/k8s-monitoring/tests/integration/${{ matrix.test }}/deps.json" ]; then
# e.g. ["terraform", "vendir"]
echo "deps=$(jq --compact-output '.' charts/k8s-monitoring/tests/integration/${{ matrix.test }}/deps.json)" >> $GITHUB_ENV
else
echo "deps=[]" >> $GITHUB_ENV
fi
- name: Install terraform
uses: hashicorp/setup-terraform@v3
if: contains(env.deps, 'terraform')
- name: Run test
run: ./scripts/run-cluster-test.sh "charts/k8s-monitoring/tests/integration/${{ matrix.test }}"
env:
CREATE_CLUSTER: "true"
DELETE_CLUSTER: "true"