@@ -13,13 +13,208 @@ 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_DB : perfkit_db_ci
59+ MSSQL_USER : perfkit_db_runner
60+ MSSQL_PASSWORD : MyP@ssw0rd123 # example value of a secret compliant with MS SQL Server password policy
61+ MSSQL_DATA_DIR : /var/opt/mssql/data
62+ MSSQL_LOG_DIR : /var/opt/mssql/log
63+ MSSQL_BACKUP_DIR : /var/opt/mssql/backup
64+ MSSQL_AGENT_ENABLED : true
65+ ports :
66+ - 1433:1433
67+
68+ cassandra :
69+ image : cassandra:4.0
70+ env :
71+ CASSANDRA_USER : admin
72+ CASSANDRA_PASSWORD : password # example value of a secret
73+ ports :
74+ - " 9042:9042"
75+ options : >-
76+ --health-cmd="cqlsh -u cassandra -p cassandra 127.0.0.1 9042 --execute='describe keyspaces'"
77+ --health-interval=20s
78+ --health-timeout=10s
79+ --health-retries=15
80+ --health-start-period=60s
81+
82+ clickhouse :
83+ image : clickhouse/clickhouse-server:24.10-alpine
84+ env :
85+ CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT : 1
86+ CLICKHOUSE_DB : perfkit_db_ci
87+ CLICKHOUSE_USER : username
88+ CLICKHOUSE_PASSWORD : password # example value of a secret
89+ ports :
90+ - " 8123:8123"
91+ - " 9000:9000"
92+
93+ elasticsearch :
94+ image : docker.elastic.co/elasticsearch/elasticsearch:8.15.1
95+ env :
96+ node.name : es-test
97+ cluster.name : es-docker-cluster
98+ bootstrap.memory_lock : true
99+ discovery.type : single-node
100+ ES_JAVA_OPTS : -Xms1g -Xmx1g
101+ xpack.security.enabled : false
102+ xpack.security.http.ssl.enabled : false
103+ xpack.security.transport.ssl.enabled : false
104+ action.auto_create_index : true
105+ ports :
106+ - 9200:9200
107+ # Health check for Elasticsearch
108+ options : >-
109+ --health-cmd "curl -s http://127.0.0.1:9200/_cluster/health?wait_for_status=yellow&timeout=30s || exit 1"
110+ --health-interval 10s
111+ --health-timeout 5s
112+ --health-retries 10
113+
114+ opensearch :
115+ image : opensearchproject/opensearch:2.18.0
116+ env :
117+ node.name : os-test
118+ discovery.type : single-node
119+ OPENSEARCH_JAVA_OPTS : -Xms512m -Xmx512m
120+ OPENSEARCH_INITIAL_ADMIN_PASSWORD : bgnYFGR2RhN3SCX # example value of a secret compliant with OpenSearch password policy
121+ plugins.security.ssl.http.enabled : false
122+ ports :
123+ - 9201:9200
124+ - 9600:9600
125+ # Health check for OpenSearch
126+ options : >-
127+ --health-cmd "curl -s -u admin:bgnYFGR2RhN3SCX http://127.0.0.1:9201/_cluster/health?wait_for_status=yellow&timeout=30s || exit 1"
128+ --health-interval 20s
129+ --health-timeout 30s
130+ --health-retries 15
131+ --health-start-period 60s
132+
16133 steps :
17134 - uses : actions/checkout@v4
18135
19136 - name : Set up Go
20137 uses : actions/setup-go@v4
21138 with :
22139 go-version : ' 1.22'
140+
141+ - name : Install database clients
142+ run : |
143+ # Install PostgreSQL client
144+ sudo apt-get update
145+ sudo apt-get install -y postgresql-client
146+ # Install SQL Server tools
147+ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
148+ curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
149+ sudo apt-get update
150+ sudo ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev
23151
24- - name : Test
25- run : go test -v ./benchmark/...
152+ - name : Create SQL Server user and database
153+ run : |
154+ # Wait for SQL Server to be ready (max 30 attempts)
155+ for i in {1..30}; do
156+ if /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MyP@ssw0rd123 -Q "SELECT 1" -b -o /dev/null; then
157+ echo "SQL Server is ready!"
158+ break
159+ fi
160+ echo "Waiting for SQL Server... (attempt $i/30)";
161+ sleep 5;
162+ done
163+
164+ # Create database and user
165+ /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MyP@ssw0rd123 -Q "
166+ IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'perfkit_db_ci')
167+ BEGIN
168+ CREATE DATABASE perfkit_db_ci;
169+ END
170+ GO
171+ USE perfkit_db_ci;
172+ GO
173+ IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = 'perfkit_db_runner')
174+ BEGIN
175+ CREATE LOGIN perfkit_db_runner WITH PASSWORD = 'MyP@ssw0rd123';
176+ END
177+ GO
178+ IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = 'perfkit_db_runner')
179+ BEGIN
180+ CREATE USER perfkit_db_runner FOR LOGIN perfkit_db_runner;
181+ END
182+ GO
183+ ALTER ROLE db_owner ADD MEMBER perfkit_db_runner;
184+ GO
185+ "
186+ echo "Database and user created successfully"
187+
188+ - name : Create vector extension
189+ run : PGPASSWORD=password psql -h localhost -U root -d perfkit_pg_vector_db_ci -c "CREATE EXTENSION vector;"
190+
191+ - name : Create Cassandra keyspace
192+ run : |
193+ # Wait for Cassandra to be ready (max 30 attempts)
194+ for i in {1..30}; do
195+ if printf "" 2>>/dev/null >>/dev/tcp/127.0.0.1/9042; then
196+ echo "Cassandra is ready!"
197+ break
198+ fi
199+ echo "Waiting for cassandra... (attempt $i/30)";
200+ sleep 5;
201+ done
202+
203+ echo "Creating keyspace..."
204+ 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};"
205+ echo "Keyspace created"
206+
207+ - name : Test with Coverage
208+ run : |
209+ go test -v -coverprofile=benchmark_coverage.txt -covermode=atomic ./benchmark/...
210+ go test -v -coverprofile=logger_coverage.txt -covermode=atomic ./logger/...
211+ go test -v -coverprofile=restrelay_coverage.txt -covermode=atomic ./acronis-restrelay-bench/...
212+ go test -v -coverprofile=db_coverage.txt -covermode=atomic ./db/...
213+ go test -v -coverprofile=db_bench_coverage.txt -covermode=atomic ./acronis-db-bench/...
214+
215+ - name : Upload results to Codecov
216+ uses : codecov/codecov-action@v5
217+ with :
218+ token : ${{ secrets.CODECOV_TOKEN }}
219+ files : benchmark_coverage.txt,logger_coverage.txt,restrelay_coverage.txt,db_coverage.txt,db_bench_coverage.txt
220+ fail_ci_if_error : true
0 commit comments