This commit is contained in:
@@ -3,15 +3,42 @@ set -euo pipefail
|
|||||||
|
|
||||||
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||||
|
|
||||||
|
# FUNCTIONS
|
||||||
|
function title() {
|
||||||
|
echo "----------------------------------------"
|
||||||
|
# Center the text
|
||||||
|
local text="$1"
|
||||||
|
local line_length=40
|
||||||
|
local text_length=${#text}
|
||||||
|
local padding=$(( (line_length - text_length) / 2 ))
|
||||||
|
printf "%*s%s%*s\n" $padding "" "$text" $padding ""
|
||||||
|
echo "----------------------------------------"
|
||||||
|
}
|
||||||
|
|
||||||
|
function die() {
|
||||||
|
title "error: $1"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
# build the executable
|
# build the executable
|
||||||
|
title "Building amd64 executable"
|
||||||
"${SCRIPT_DIR}/build.sh" amd64
|
"${SCRIPT_DIR}/build.sh" amd64
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
# build the docker image
|
# build the docker image
|
||||||
|
title "Building docker image"
|
||||||
docker buildx build --load -t gitea.jde.nz/public/simple-object-storage:test --platform linux/amd64 .
|
docker buildx build --load -t gitea.jde.nz/public/simple-object-storage:test --platform linux/amd64 .
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
# run the docker container
|
||||||
|
title "Running docker container"
|
||||||
export LOCALCONFIG="${SCRIPT_DIR}/.test-docker/config.json"
|
export LOCALCONFIG="${SCRIPT_DIR}/.test-docker/config.json"
|
||||||
|
|
||||||
if [ ! -f "${LOCALCONFIG}" ]; then
|
if [ ! -f "${LOCALCONFIG}" ]; then
|
||||||
|
echo "PWD = $(pwd)"
|
||||||
|
echo "SCRIPT_DIR = ${SCRIPT_DIR}"
|
||||||
|
ls -la "${SCRIPT_DIR}"
|
||||||
echo "Config file not found: ${LOCALCONFIG}"
|
echo "Config file not found: ${LOCALCONFIG}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -23,8 +50,12 @@ if [ ! -f "${COMPOSE_FILE}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
title "Running tests"
|
||||||
|
|
||||||
docker compose -f "${COMPOSE_FILE}" up -d
|
docker compose -f "${COMPOSE_FILE}" up -d
|
||||||
|
|
||||||
|
|
||||||
"${SCRIPT_DIR}/test.sh" "http://localhost:7703"
|
"${SCRIPT_DIR}/test.sh" "http://localhost:7703"
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user