#!/bin/bash -xe echo "starting sanity test..." export SEALIOUS_PORT=$PORT SEALIOUS_BASE_URL=$(cat .base_url) export SEALIOUS_BASE_URL ./npm.sh ci --no-progress --no-color ./npm.sh run install-test-deps --no-progress --no-color ./npm.sh run build --no-progress --no-color --ignore-scripts ./npm.sh run typecheck --no-progress --no-color --ignore-scripts # no need to run build, it's automatically ran after ci #./npm.sh --no-TTY --user="$UID" run build ./npm.sh run lint-report node -e 'console.log(JSON.stringify(JSON.parse(fs.readFileSync("./.eslint-result.json")).map(fileResult => fileResult.messages.map(message=>({...message, path: fileResult.filePath.replace("/opt/sealious-app/", "")}))).flat().map(message=>({name: message.ruleId, code: message.ruleId, severity: message.severity==1 ? "warning" : "error", path: message.path, line: message.line, char: message.column, description: message.message}))))' \ >lint-report.json CONTAINER_ID=$(docker compose run -d --user="$UID" \ -e "SEALIOUS_MONGO_PORT=27017" \ -e "SEALIOUS_MONGO_HOST=db" \ -e "SEALIOUS_PORT=8080" \ -e "SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL" \ -e "SEALIOUS_MAILCATCHER_HOST=mailcatcher" \ -e "SEALIOUS_MAILCATCHER_API_PORT=1080" \ -e "SEALIOUS_MAILCATCHER_SMTP_PORT=1025" \ -e "WITH_WEBHINT=TRUE" \ -e "FORCE_COLOR=0" \ test npm run test-reports) docker logs -f $CONTAINER_ID exit $(docker inspect $CONTAINER_ID --format='{{.State.ExitCode}}')