-
Notifications
You must be signed in to change notification settings - Fork 438
153 lines (133 loc) · 4.09 KB
/
ci.yml
File metadata and controls
153 lines (133 loc) · 4.09 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Lint and Unit Test Charts
on: pull_request
permissions:
contents: read
jobs:
lint-test:
runs-on: ubuntu-latest
services:
cassandra:
image: cassandra:4.1
env:
CASSANDRA_CLUSTER_NAME: test-cluster
CASSANDRA_DC: dc1
CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
ports:
- 9042:9042
options: >-
--health-cmd "cqlsh -e 'describe cluster'"
--health-interval 10s
--health-timeout 5s
--health-retries 30
postgres:
image: postgres:15
env:
POSTGRES_DB: testdb
POSTGRES_USER: temporal
POSTGRES_PASSWORD: temporal
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: temporal
MYSQL_DATABASE: temporal
MYSQL_USER: temporal
MYSQL_PASSWORD: temporal
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h localhost -u root -ppassword"
--health-interval 10s
--health-timeout 5s
--health-retries 5
elasticsearch:
image: elasticsearch:8.11.0
env:
discovery.type: single-node
xpack.security.enabled: false
ES_JAVA_OPTS: -Xms512m -Xmx512m
ports:
- 9200:9200
options: >-
--health-cmd "curl -f http://localhost:9200/_cluster/health || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.19.2
- uses: actions/setup-python@v5
with:
python-version: '3.x'
check-latest: true
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
- name: Run chart-testing (lint)
run: ct lint --check-version-increment=false --target-branch ${{ github.event.repository.default_branch }}
- name: Install helm-unittest
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version v1.0.3
- name: Run helm-unittest
working-directory: charts/temporal
run: helm unittest .
- name: Create kind cluster
uses: helm/kind-action@v1.13.0
- name: Get Docker host gateway IP
id: docker
run: |
HOST_IP=$(docker network inspect bridge -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}')
echo "host_ip=$HOST_IP" >> $GITHUB_OUTPUT
echo "Docker host IP: $HOST_IP"
- name: Expose persistence backend services to Kubernetes
run: |
HOST_IP="${{ steps.docker.outputs.host_ip }}"
echo "Using HOST_IP: $HOST_IP"
create_service() {
local name=$1
local port=$2
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
name: ${name}
namespace: default
spec:
ports:
- port: ${port}
protocol: TCP
targetPort: ${port}
clusterIP: None
---
apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata:
name: ${name}-1
namespace: default
labels:
kubernetes.io/service-name: ${name}
addressType: IPv4
ports:
- port: ${port}
protocol: TCP
endpoints:
- addresses:
- ${HOST_IP}
EOF
}
create_service cassandra 9042
create_service postgres 5432
create_service mysql 3306
create_service elasticsearch 9200
- name: Run chart-testing (install)
run: ct install --target-branch ${{ github.event.repository.default_branch }}