ci: stabilize pipeline
This commit is contained in:
27
scripts/run-ci-pipeline.sh
Executable file
27
scripts/run-ci-pipeline.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
echo ">>> Running containerized test suites"
|
||||
"${ROOT_DIR}/scripts/run-ci-tests.sh"
|
||||
|
||||
GIT_SHA="$(git -C "${ROOT_DIR}" rev-parse --short HEAD)"
|
||||
BACKEND_IMAGE="merchantsofhope-supplyanddemandportal-backend:${GIT_SHA}"
|
||||
FRONTEND_IMAGE="merchantsofhope-supplyanddemandportal-frontend:${GIT_SHA}"
|
||||
|
||||
echo ">>> Building backend image ${BACKEND_IMAGE}"
|
||||
docker build -f "${ROOT_DIR}/backend/Dockerfile" -t "${BACKEND_IMAGE}" "${ROOT_DIR}/backend"
|
||||
|
||||
echo ">>> Building frontend image ${FRONTEND_IMAGE}"
|
||||
docker build -f "${ROOT_DIR}/frontend/Dockerfile" -t "${FRONTEND_IMAGE}" "${ROOT_DIR}/frontend"
|
||||
|
||||
cat <<EOF
|
||||
|
||||
=== CI pipeline simulation complete ===
|
||||
Backend tests, frontend tests, and image builds finished successfully.
|
||||
Local tags:
|
||||
${BACKEND_IMAGE}
|
||||
${FRONTEND_IMAGE}
|
||||
Use 'docker images' to inspect or 'docker rmi' to clean up.
|
||||
EOF
|
||||
23
scripts/run-ci-tests.sh
Executable file
23
scripts/run-ci-tests.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
COMPOSE_FILE="${COMPOSE_FILE:-docker-compose.test.yml}"
|
||||
|
||||
cleanup() {
|
||||
docker compose -f "${COMPOSE_FILE}" down -v >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
cleanup
|
||||
trap cleanup EXIT
|
||||
|
||||
run_stage() {
|
||||
local service="$1"
|
||||
echo ">>> Running ${service} tests inside container"
|
||||
docker compose -f "${COMPOSE_FILE}" build "${service}"
|
||||
docker compose -f "${COMPOSE_FILE}" run --rm "${service}"
|
||||
}
|
||||
|
||||
run_stage backend-tester
|
||||
run_stage frontend-tester
|
||||
|
||||
echo "All CI test stages completed successfully (containers only)."
|
||||
Reference in New Issue
Block a user