forked from kloeckner-i/charts
-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (94 loc) · 2.92 KB
/
test.yaml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
get-chart:
runs-on: ubuntu-latest
outputs:
changed_charts: ${{ steps.get-chart.outputs.changed_charts }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: charts
fetch-depth: 2 # to be able to obtain files changed in the latest commit
- id: get-chart
name: "Get modified charts"
run: |
cd charts
files_changed="$(git diff --name-only HEAD^ HEAD)"
# Adding || true to avoid "Process exited with code 1" errors
charts_dirs_changed="$(echo "$files_changed" | xargs dirname | grep -o "charts/[^/]*" | sed "s|charts/||g" | uniq | tr '\n' ' ' || true)"
echo "changed:${charts_dirs_changed}"
echo "::set-output name=changed_charts::${charts_dirs_changed}"
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.9.4
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (lint)
run: ct lint --validate-maintainers=false --target-branch main
test-values:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run the test
run: |
cd charts/db-operator
./scripts/test_values -p ./ci/unit-test
db-operator-test:
runs-on: ubuntu-latest
needs: get-chart
if: ${{ contains(needs.get-chart.outputs.changed_charts, 'db-operator') || contains(needs.get-chart.outputs.changed_charts, 'db-instances') }}
strategy:
matrix:
k8s_version:
[
"v1.22.8",
"v1.23.5",
"v1.24.16",
"v1.25.12",
"v1.26.7",
"v1.27.4",
]
steps:
- name: Checkout
uses: actions/checkout@v3
# The existing apparmor profile for mysql needs to be removed.
# https://github.com/actions/virtual-environments/issues/181
# https://github.com/moby/moby/issues/7512#issuecomment-51845976
- name: Remove MySQL App Armour Configuration
run: |
set -x
sudo apt-get remove mysql-server --purge
sudo apt-get update -y
sudo apt-get install apparmor-profiles
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- name: Create k3d cluster
env:
K8S_VERSION: ${{ matrix.k8s_version }}
run: make k3d
- name: Install Cert Manager
run: make cert-manager
- name: Install Helm chart
run: make db-operator
- name: Integration test
run: ./tests/db-operator/integration.sh