All checks were successful
Build, test and publish / verify (push) Successful in 1m41s
59 lines
2.6 KiB
Bash
59 lines
2.6 KiB
Bash
#!/usr/bin/env bash
|
|
source "$(dirname -- "$0")/common.sh"
|
|
export CI=true
|
|
# Start fresh: an earlier attempt's success marker must never authorize publishing.
|
|
rm -f "$ARTIFACTS/verified-commit"
|
|
exec > >(tee "$ARTIFACTS/verify.log") 2>&1
|
|
finish() {
|
|
local status=$?
|
|
trap - EXIT
|
|
bash "$CI_ROOT/ci/cleanup.sh" || { (( status != 0 )) || status=1; }
|
|
if [[ -n "${CI_DOCKER_CONFIG:-}" ]]; then rm -rf -- "$CI_DOCKER_CONFIG"; fi
|
|
exit "$status"
|
|
}
|
|
trap finish EXIT
|
|
trap 'exit 143' TERM
|
|
trap 'exit 130' INT
|
|
require_platform
|
|
isolate_docker_config
|
|
[[ "$(git rev-parse HEAD)" == "$CI_COMMIT" ]] || { echo 'Checkout does not match pushed commit'; exit 1; }
|
|
java -version
|
|
node --version
|
|
mvn -B -ntp clean verify
|
|
python3 -m unittest discover -s ci/tests -v
|
|
(
|
|
cd agiledancers-fe
|
|
npm ci
|
|
npm test -- --reporters=default --reporters=junit --output-file=unit-results/junit.xml
|
|
npm run build
|
|
)
|
|
docker build --platform "$TARGET_PLATFORM" --target prebuilt \
|
|
--label "org.opencontainers.image.revision=$CI_COMMIT" -t "$BACKEND_IMAGE" .
|
|
docker build --platform "$TARGET_PLATFORM" --target prebuilt \
|
|
--label "org.opencontainers.image.revision=$CI_COMMIT" -t "$FRONTEND_IMAGE" agiledancers-fe
|
|
|
|
touch "$ARTIFACTS/containers-started"
|
|
docker network create --label "agiledancers.ci.run=$RUN_NAME" "$RUN_NAME"
|
|
docker run -d --name "$RUN_NAME-backend" --label "agiledancers.ci.run=$RUN_NAME" \
|
|
--platform "$TARGET_PLATFORM" --network "$RUN_NAME" --network-alias backend \
|
|
--memory 1g --cpus 2 "$BACKEND_IMAGE"
|
|
docker run -d --name "$RUN_NAME-frontend" --label "agiledancers.ci.run=$RUN_NAME" \
|
|
--platform "$TARGET_PLATFORM" --network "$RUN_NAME" --network-alias frontend \
|
|
--memory 256m --cpus 1 "$FRONTEND_IMAGE"
|
|
# The browser, tests, readiness checks and API cleanup all use the frontend proxy.
|
|
# Install this test container's browser dependencies for the exact lockfile version.
|
|
docker run --name "$RUN_NAME-browser" --label "agiledancers.ci.run=$RUN_NAME" \
|
|
--platform "$TARGET_PLATFORM" --network "$RUN_NAME" --memory 2g --cpus 2 --shm-size=1g \
|
|
--user "$(id -u):$(id -g)" --env HOME=/tmp --env CI=true \
|
|
--env PLAYWRIGHT_BASE_URL=http://frontend:8080 \
|
|
--volume "$CI_ROOT/agiledancers-fe:/workspace" --workdir /workspace \
|
|
mcr.microsoft.com/playwright:v1.64.1-noble bash -euc '
|
|
for attempt in $(seq 1 60); do
|
|
if curl --fail --silent http://frontend:8080/api/dance-schools >/dev/null; then break; fi
|
|
if [ "$attempt" = 60 ]; then echo "Application readiness timed out" >&2; exit 1; fi
|
|
sleep 2
|
|
done
|
|
npm run e2e
|
|
'
|
|
printf '%s\n' "$CI_COMMIT" > "$ARTIFACTS/verified-commit"
|