aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2025-10-10 17:42:56 -0400
committerEugene Triguba <hello@eugenetriguba.com>2025-10-10 17:42:56 -0400
commit69809346b7c5c710eca080e5390244be53dc2732 (patch)
tree4fdb6a63437ddd9d27eef5ddfb2cb8c2613dcb89 /tools
parentInstall shadow-uidmap instead of shadow (diff)
downloadcli-69809346b7c5c710eca080e5390244be53dc2732.zip
Replace tools with scripts and use them in .build.yml
Diffstat (limited to 'tools')
-rwxr-xr-xtools/db.sh47
-rw-r--r--tools/lib.sh16
-rwxr-xr-xtools/test.sh25
3 files changed, 0 insertions, 88 deletions
diff --git a/tools/db.sh b/tools/db.sh
deleted file mode 100755
index 8e6f2b9..0000000
--- a/tools/db.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-#
-# Start/Stop test databases.
-#
-# Subcommands:
-# start <database-name>: Start a particular database.
-# stop <database-name>: Stop a particular database.
-#
-# Usage:
-# $ ./tools/db.sh start <database-name>
-# $ ./tools/db.sh stop <database-name>
-set +e
-
-SCRIPT_DIR=$(dirname "$0")
-. "$SCRIPT_DIR/lib.sh"
-
-BASE_DIR=$(dirname "$0")/..
-ALLOWED_DBS=("postgresql" "mysql" "mssql")
-ALLOWED_COMMANDS=("start" "stop")
-
-function main() {
- local COMMAND="$1"
- if ! elementIn "$COMMAND" "${ALLOWED_COMMANDS[@]}"; then
- echo "Error: Invalid command. Allowed subcommands are: ${ALLOWED_COMMANDS[*]}" >&2
- exit 1
- fi
- local DB_NAME="$2"
- if ! elementIn "$DB_NAME" "${ALLOWED_DBS[@]}"; then
- echo "Error: Invalid database type. Allowed types are: ${ALLOWED_DBS[*]}" >&2
- exit 1
- fi
-
- case $COMMAND in
- start)
- env $(cat "$BASE_DIR/.env.$DB_NAME" | xargs) docker compose -f "$BASE_DIR/docker-compose.$DB_NAME.yml" up -d
- ;;
- stop)
- env $(cat "$BASE_DIR/.env.$DB_NAME" | xargs) docker compose -f "$BASE_DIR/docker-compose.$DB_NAME.yml" down
- ;;
- *)
- echo "Error: Invalid command. Use 'start' or 'stop'."
- exit 1
- ;;
- esac
-}
-
-main "$@"
diff --git a/tools/lib.sh b/tools/lib.sh
deleted file mode 100644
index e2c2c78..0000000
--- a/tools/lib.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-# elementIn checks whether a element is in an array.
-#
-# Args:
-# $1: The element
-# $2: The array
-#
-# Returns:
-# 0 if the element is in the array; 1 otherwise.
-function elementIn() {
- local e match="$1"
- shift
- for e; do [[ "$e" == "$match" ]] && return 0; done
- return 1
-}
diff --git a/tools/test.sh b/tools/test.sh
deleted file mode 100755
index c03678c..0000000
--- a/tools/test.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-#
-# Run tests against a particular database.
-#
-# Usage:
-# $ ./tools/test.sh <database-name>
-set +e
-
-SCRIPT_DIR=$(dirname "$0")
-. "$SCRIPT_DIR/lib.sh"
-
-BASE_DIR=$(dirname "$0")/..
-ALLOWED_DBS=("postgresql" "mysql" "mssql" "sqlite3")
-
-function main() {
- local DB_NAME="$1"
- if ! elementIn "$DB_NAME" "${ALLOWED_DBS[@]}"; then
- echo "Error: Invalid database type. Allowed types are: ${ALLOWED_DBS[*]}" >&2
- exit 1
- fi
-
- env $(cat "$BASE_DIR/.env.$DB_NAME" | xargs) go test -p 1 -tags "$DB_NAME" -cover -coverprofile cover.out ./...
-}
-
-main "$@"