aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/combine-coverage.sh8
-rwxr-xr-xscripts/test-mssql.sh22
-rwxr-xr-xscripts/test-mysql.sh18
-rwxr-xr-xscripts/test-postgresql.sh18
-rwxr-xr-xscripts/test-sqlite3.sh6
-rwxr-xr-xscripts/upload-coverage.sh14
6 files changed, 86 insertions, 0 deletions
diff --git a/scripts/combine-coverage.sh b/scripts/combine-coverage.sh
new file mode 100755
index 0000000..885cda8
--- /dev/null
+++ b/scripts/combine-coverage.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -e
+
+echo "Combining coverage reports..."
+go run github.com/wadey/gocovmerge@b5bfa59ec0adc420475f97f89b58045c721d761c coverage-*.out > coverage.combined.out
+
+echo "Combined coverage report:"
+go tool cover -func=coverage.combined.out
diff --git a/scripts/test-mssql.sh b/scripts/test-mssql.sh
new file mode 100755
index 0000000..1569992
--- /dev/null
+++ b/scripts/test-mssql.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+set -e
+
+echo "Running MSSQL tests..."
+env $(cat .env.mssql | xargs) docker-compose -f docker-compose.mssql.yml up -d
+
+echo "Waiting for MSSQL to be ready..."
+sleep 20
+
+# Read password from .env.mssql if available
+MSSQL_PASSWORD="${MSSQL_SA_PASSWORD:-YourStrong@Passw0rd}"
+
+until docker exec bolt_mssql_db /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_PASSWORD" -Q "SELECT 1" &>/dev/null; do
+ echo "Waiting for MSSQL..."
+ sleep 5
+done
+echo "MSSQL is ready."
+
+env $(cat .env.mssql | xargs) go test -p 1 -tags "mssql" -covermode=count -coverprofile=coverage-mssql.out ./...
+
+docker-compose -f docker-compose.mssql.yml down
+echo "MSSQL tests completed."
diff --git a/scripts/test-mysql.sh b/scripts/test-mysql.sh
new file mode 100755
index 0000000..792c2f9
--- /dev/null
+++ b/scripts/test-mysql.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+set -e
+
+echo "Running MySQL tests..."
+env $(cat .env.mysql | xargs) docker-compose -f docker-compose.mysql.yml up -d
+
+echo "Waiting for MySQL to be ready..."
+sleep 15
+until docker exec bolt_mysql_db mysqladmin ping -h localhost --silent 2>/dev/null; do
+ echo "Waiting for MySQL..."
+ sleep 5
+done
+echo "MySQL is ready."
+
+env $(cat .env.mysql | xargs) go test -p 1 -tags "mysql" -covermode=count -coverprofile=coverage-mysql.out ./...
+
+docker-compose -f docker-compose.mysql.yml down
+echo "MySQL tests completed."
diff --git a/scripts/test-postgresql.sh b/scripts/test-postgresql.sh
new file mode 100755
index 0000000..38decae
--- /dev/null
+++ b/scripts/test-postgresql.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+set -e
+
+echo "Running PostgreSQL tests..."
+env $(cat .env.postgresql | xargs) docker-compose -f docker-compose.postgresql.yml up -d
+
+echo "Waiting for PostgreSQL to be ready..."
+sleep 10
+until docker exec bolt_postgresql_db pg_isready -U postgres 2>/dev/null; do
+ echo "Waiting for PostgreSQL..."
+ sleep 5
+done
+echo "PostgreSQL is ready."
+
+env $(cat .env.postgresql | xargs) go test -p 1 -tags "postgresql" -covermode=count -coverprofile=coverage-postgresql.out ./...
+
+docker-compose -f docker-compose.postgresql.yml down
+echo "PostgreSQL tests completed."
diff --git a/scripts/test-sqlite3.sh b/scripts/test-sqlite3.sh
new file mode 100755
index 0000000..60c3a4c
--- /dev/null
+++ b/scripts/test-sqlite3.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -e
+
+echo "Running SQLite3 tests..."
+env $(cat .env.sqlite3 | xargs) go test -p 1 -tags "sqlite3" -covermode=count -coverprofile=coverage-sqlite3.out ./...
+echo "SQLite3 tests completed."
diff --git a/scripts/upload-coverage.sh b/scripts/upload-coverage.sh
new file mode 100755
index 0000000..ed57729
--- /dev/null
+++ b/scripts/upload-coverage.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -e
+
+if [ -z "$CODECOV_TOKEN" ]; then
+ echo "Warning: CODECOV_TOKEN not set, skipping upload"
+ exit 0
+fi
+
+echo "Uploading coverage to Codecov..."
+curl -Os https://uploader.codecov.io/latest/linux/codecov
+chmod +x codecov
+./codecov -t "$CODECOV_TOKEN" -f coverage.combined.out -F unittests -n bolt-coverage
+
+echo "Coverage uploaded successfully."