forked from acronis/perfkit
-
Notifications
You must be signed in to change notification settings - Fork 0
217 lines (196 loc) · 7.61 KB
/
go.yml
File metadata and controls
217 lines (196 loc) · 7.61 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
services:
# Database service containers
mariadb-vector:
image: mariadb:11.7.2
env:
MARIADB_DATABASE: perfkit_db_ci
MARIADB_USER: user
MARIADB_PASSWORD: password # example value of a secret
MARIADB_ROOT_PASSWORD: password # example value of a secret
ports:
- 3306:3306
# Additional options to handle GitHub Actions environment limitations
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=3
postgres:
image: ankane/pgvector:v0.5.1
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: password # example value of a secret
POSTGRES_DB: perfkit_pg_vector_db_ci
ports:
- 5432:5432
# Health check to wait until postgres is ready
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: 'Y'
MSSQL_SA_PASSWORD: MyP@ssw0rd123 # example value of a secret compliant with MS SQL Server password policy
MSSQL_PID: Developer
MSSQL_TCP_PORT: 1433
MSSQL_COLLATION: SQL_Latin1_General_CP1_CI_AS
MSSQL_DATA_DIR: /var/opt/mssql/data
MSSQL_LOG_DIR: /var/opt/mssql/log
MSSQL_BACKUP_DIR: /var/opt/mssql/backup
MSSQL_AGENT_ENABLED: true
ports:
- 1433:1433
cassandra:
image: cassandra:4.0
env:
CASSANDRA_USER: admin
CASSANDRA_PASSWORD: password # example value of a secret
ports:
- "9042:9042"
options: >-
--health-cmd="cqlsh -u cassandra -p cassandra 127.0.0.1 9042 --execute='describe keyspaces'"
--health-interval=20s
--health-timeout=10s
--health-retries=15
--health-start-period=60s
clickhouse:
image: clickhouse/clickhouse-server:24.10-alpine
env:
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
CLICKHOUSE_DB: perfkit_db_ci
CLICKHOUSE_USER: username
CLICKHOUSE_PASSWORD: password # example value of a secret
ports:
- "8123:8123"
- "9000:9000"
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.15.1
env:
node.name: es-test
cluster.name: es-docker-cluster
bootstrap.memory_lock: true
discovery.type: single-node
ES_JAVA_OPTS: -Xms1g -Xmx1g
xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
action.auto_create_index: true
ports:
- 9200:9200
# Health check for Elasticsearch
options: >-
--health-cmd "curl -s http://127.0.0.1:9200/_cluster/health?wait_for_status=yellow&timeout=30s || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 10
opensearch:
image: opensearchproject/opensearch:2.18.0
env:
node.name: os-test
discovery.type: single-node
OPENSEARCH_JAVA_OPTS: -Xms512m -Xmx512m
OPENSEARCH_INITIAL_ADMIN_PASSWORD: bgnYFGR2RhN3SCX # example value of a secret compliant with OpenSearch password policy
plugins.security.ssl.http.enabled: false
ports:
- 9201:9200
- 9600:9600
# Health check for OpenSearch
options: >-
--health-cmd "curl -s -u admin:bgnYFGR2RhN3SCX http://127.0.0.1:9201/_cluster/health?wait_for_status=yellow&timeout=30s || exit 1"
--health-interval 20s
--health-timeout 30s
--health-retries 15
--health-start-period 60s
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Install database clients
run: |
# Install PostgreSQL client
sudo apt-get update
sudo apt-get install -y postgresql-client
# Install SQL Server tools
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev
- name: Create SQL Server user and database
run: |
# Wait for SQL Server to be ready (max 30 attempts)
for i in {1..30}; do
if /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MyP@ssw0rd123 -Q "SELECT 1" -b -o /dev/null; then
echo "SQL Server is ready!"
break
fi
echo "Waiting for SQL Server... (attempt $i/30)";
sleep 5;
done
# Create database and user
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MyP@ssw0rd123 -Q "
IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'perfkit_db_ci')
BEGIN
CREATE DATABASE perfkit_db_ci;
END
GO
USE perfkit_db_ci;
GO
IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = 'perfkit_db_runner')
BEGIN
CREATE LOGIN perfkit_db_runner WITH PASSWORD = 'MyP@ssw0rd123';
END
GO
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = 'perfkit_db_runner')
BEGIN
CREATE USER perfkit_db_runner FOR LOGIN perfkit_db_runner;
END
GO
ALTER ROLE db_owner ADD MEMBER perfkit_db_runner;
GO
"
echo "Database and user created successfully"
- name: Create vector extension
run: PGPASSWORD=password psql -h localhost -U root -d perfkit_pg_vector_db_ci -c "CREATE EXTENSION vector;"
- name: Create Cassandra keyspace
run: |
# Wait for Cassandra to be ready (max 30 attempts)
for i in {1..30}; do
if printf "" 2>>/dev/null >>/dev/tcp/127.0.0.1/9042; then
echo "Cassandra is ready!"
break
fi
echo "Waiting for cassandra... (attempt $i/30)";
sleep 5;
done
echo "Creating keyspace..."
docker exec ${{ job.services.cassandra.id }} cqlsh -u cassandra -p cassandra -e "CREATE KEYSPACE IF NOT EXISTS perfkit_db_ci WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};"
echo "Keyspace created"
- name: Test with Coverage
run: |
go test -v -coverprofile=benchmark_coverage.txt -covermode=atomic ./benchmark/...
go test -v -coverprofile=logger_coverage.txt -covermode=atomic ./logger/...
go test -v -coverprofile=restrelay_coverage.txt -covermode=atomic ./acronis-restrelay-bench/...
go test -v -coverprofile=db_coverage.txt -covermode=atomic ./db/...
go test -v -coverprofile=db_bench_coverage.txt -covermode=atomic ./acronis-db-bench/...
- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: benchmark_coverage.txt,logger_coverage.txt,restrelay_coverage.txt,db_coverage.txt,db_bench_coverage.txt
fail_ci_if_error: true