@@ -13,13 +13,205 @@ jobs:
1313
1414 build :
1515 runs-on : ubuntu-latest
16+
17+ services :
18+ # Database service containers
19+ mariadb-vector :
20+ image : mariadb:11.7.2
21+ env :
22+ MARIADB_DATABASE : perfkit_db_ci
23+ MARIADB_USER : user
24+ MARIADB_PASSWORD : password # example value of a secret
25+ MARIADB_ROOT_PASSWORD : password # example value of a secret
26+ ports :
27+ - 3306:3306
28+ # Additional options to handle GitHub Actions environment limitations
29+ options : >-
30+ --health-cmd="healthcheck.sh --connect --innodb_initialized"
31+ --health-interval=10s
32+ --health-timeout=5s
33+ --health-retries=3
34+
35+ postgres :
36+ image : ankane/pgvector:v0.5.1
37+ env :
38+ POSTGRES_USER : root
39+ POSTGRES_PASSWORD : password # example value of a secret
40+ POSTGRES_DB : perfkit_pg_vector_db_ci
41+ ports :
42+ - 5432:5432
43+ # Health check to wait until postgres is ready
44+ options : >-
45+ --health-cmd pg_isready
46+ --health-interval 10s
47+ --health-timeout 5s
48+ --health-retries 5
49+
50+ mssql :
51+ image : mcr.microsoft.com/mssql/server:2019-latest
52+ env :
53+ ACCEPT_EULA : ' Y'
54+ MSSQL_SA_PASSWORD : MyP@ssw0rd123 # example value of a secret compliant with MS SQL Server password policy
55+ MSSQL_PID : Developer
56+ MSSQL_TCP_PORT : 1433
57+ MSSQL_COLLATION : SQL_Latin1_General_CP1_CI_AS
58+ MSSQL_DATA_DIR : /var/opt/mssql/data
59+ MSSQL_LOG_DIR : /var/opt/mssql/log
60+ MSSQL_BACKUP_DIR : /var/opt/mssql/backup
61+ MSSQL_AGENT_ENABLED : true
62+ ports :
63+ - 1433:1433
64+
65+ cassandra :
66+ image : cassandra:4.0
67+ env :
68+ CASSANDRA_USER : admin
69+ CASSANDRA_PASSWORD : password # example value of a secret
70+ ports :
71+ - " 9042:9042"
72+ options : >-
73+ --health-cmd="cqlsh -u cassandra -p cassandra 127.0.0.1 9042 --execute='describe keyspaces'"
74+ --health-interval=20s
75+ --health-timeout=10s
76+ --health-retries=15
77+ --health-start-period=60s
78+
79+ clickhouse :
80+ image : clickhouse/clickhouse-server:24.10-alpine
81+ env :
82+ CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT : 1
83+ CLICKHOUSE_DB : perfkit_db_ci
84+ CLICKHOUSE_USER : username
85+ CLICKHOUSE_PASSWORD : password # example value of a secret
86+ ports :
87+ - " 8123:8123"
88+ - " 9000:9000"
89+
90+ elasticsearch :
91+ image : docker.elastic.co/elasticsearch/elasticsearch:8.15.1
92+ env :
93+ node.name : es-test
94+ cluster.name : es-docker-cluster
95+ bootstrap.memory_lock : true
96+ discovery.type : single-node
97+ ES_JAVA_OPTS : -Xms1g -Xmx1g
98+ xpack.security.enabled : false
99+ xpack.security.http.ssl.enabled : false
100+ xpack.security.transport.ssl.enabled : false
101+ action.auto_create_index : true
102+ ports :
103+ - 9200:9200
104+ # Health check for Elasticsearch
105+ options : >-
106+ --health-cmd "curl -s http://127.0.0.1:9200/_cluster/health?wait_for_status=yellow&timeout=30s || exit 1"
107+ --health-interval 10s
108+ --health-timeout 5s
109+ --health-retries 10
110+
111+ opensearch :
112+ image : opensearchproject/opensearch:2.18.0
113+ env :
114+ node.name : os-test
115+ discovery.type : single-node
116+ OPENSEARCH_JAVA_OPTS : -Xms512m -Xmx512m
117+ OPENSEARCH_INITIAL_ADMIN_PASSWORD : bgnYFGR2RhN3SCX # example value of a secret compliant with OpenSearch password policy
118+ plugins.security.ssl.http.enabled : false
119+ ports :
120+ - 9201:9200
121+ - 9600:9600
122+ # Health check for OpenSearch
123+ options : >-
124+ --health-cmd "curl -s -u admin:bgnYFGR2RhN3SCX http://127.0.0.1:9201/_cluster/health?wait_for_status=yellow&timeout=30s || exit 1"
125+ --health-interval 20s
126+ --health-timeout 30s
127+ --health-retries 15
128+ --health-start-period 60s
129+
16130 steps :
17131 - uses : actions/checkout@v4
18132
19133 - name : Set up Go
20134 uses : actions/setup-go@v4
21135 with :
22136 go-version : ' 1.22'
137+
138+ - name : Install database clients
139+ run : |
140+ # Install PostgreSQL client
141+ sudo apt-get update
142+ sudo apt-get install -y postgresql-client
143+ # Install SQL Server tools
144+ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
145+ curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
146+ sudo apt-get update
147+ sudo ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev
23148
24- - name : Test
25- run : go test -v ./benchmark/...
149+ - name : Create SQL Server user and database
150+ run : |
151+ # Wait for SQL Server to be ready (max 30 attempts)
152+ for i in {1..30}; do
153+ if /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MyP@ssw0rd123 -Q "SELECT 1" -b -o /dev/null; then
154+ echo "SQL Server is ready!"
155+ break
156+ fi
157+ echo "Waiting for SQL Server... (attempt $i/30)";
158+ sleep 5;
159+ done
160+
161+ # Create database and user
162+ /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MyP@ssw0rd123 -Q "
163+ IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'perfkit_db_ci')
164+ BEGIN
165+ CREATE DATABASE perfkit_db_ci;
166+ END
167+ GO
168+ USE perfkit_db_ci;
169+ GO
170+ IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = 'perfkit_db_runner')
171+ BEGIN
172+ CREATE LOGIN perfkit_db_runner WITH PASSWORD = 'MyP@ssw0rd123';
173+ END
174+ GO
175+ IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = 'perfkit_db_runner')
176+ BEGIN
177+ CREATE USER perfkit_db_runner FOR LOGIN perfkit_db_runner;
178+ END
179+ GO
180+ ALTER ROLE db_owner ADD MEMBER perfkit_db_runner;
181+ GO
182+ "
183+ echo "Database and user created successfully"
184+
185+ - name : Create vector extension
186+ run : PGPASSWORD=password psql -h localhost -U root -d perfkit_pg_vector_db_ci -c "CREATE EXTENSION vector;"
187+
188+ - name : Create Cassandra keyspace
189+ run : |
190+ # Wait for Cassandra to be ready (max 30 attempts)
191+ for i in {1..30}; do
192+ if printf "" 2>>/dev/null >>/dev/tcp/127.0.0.1/9042; then
193+ echo "Cassandra is ready!"
194+ break
195+ fi
196+ echo "Waiting for cassandra... (attempt $i/30)";
197+ sleep 5;
198+ done
199+
200+ echo "Creating keyspace..."
201+ 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};"
202+ echo "Keyspace created"
203+
204+ - name : Test with Coverage
205+ run : |
206+ go test -v -coverprofile=benchmark_coverage.txt -covermode=atomic ./benchmark/...
207+ go test -v -coverprofile=logger_coverage.txt -covermode=atomic ./logger/...
208+ go test -v -coverprofile=restrelay_coverage.txt -covermode=atomic ./acronis-restrelay-bench/...
209+ go test -v -coverprofile=db_coverage.txt -covermode=atomic ./db/...
210+ go test -v -coverprofile=db_bench_coverage.txt -covermode=atomic ./acronis-db-bench/...
211+
212+ - name : Upload results to Codecov
213+ uses : codecov/codecov-action@v5
214+ with :
215+ token : ${{ secrets.CODECOV_TOKEN }}
216+ files : benchmark_coverage.txt,logger_coverage.txt,restrelay_coverage.txt,db_coverage.txt,db_bench_coverage.txt
217+ fail_ci_if_error : true
0 commit comments