feat: enhance build process and testing workflow
- Updated package.json scripts to include separate unit and integration tests before building. - Added a new script `test-build-test` to run tests before and after the build process. - Introduced a new local CI/CD script for streamlined local development and testing. - Refactored PlayerTab component to normalize skills data structure and added tooltips for Space Marine and Power Armour abilities. - Added named export for Tooltip in DeathwatchRoller for reuse in other components.
This commit is contained in:
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Local CI/CD helper script
|
||||
# Usage:
|
||||
# ./scripts/local-ci.sh # run install, unit tests, integration tests, build
|
||||
# ./scripts/local-ci.sh --deploy # run above then reload pm2 (calls npm run pm2:reload)
|
||||
|
||||
echo "[local-ci] Starting local CI run"
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
echo "[local-ci] Running npm ci to ensure deterministic install"
|
||||
if npm ci; then
|
||||
echo "[local-ci] npm ci succeeded"
|
||||
else
|
||||
echo "[local-ci] npm ci failed — falling back to npm install (local dev mode)"
|
||||
npm install
|
||||
fi
|
||||
|
||||
echo "[local-ci] Running unit tests"
|
||||
npm run test:unit --silent
|
||||
|
||||
echo "[local-ci] Running integration tests (this will start/stop PM2 as configured)"
|
||||
# test:integration starts pm2, runs tests, and stops pm2
|
||||
npm run test:integration --silent
|
||||
|
||||
echo "[local-ci] Building production bundle"
|
||||
npm run build --silent
|
||||
|
||||
if [ "${1:-}" = "--deploy" ]; then
|
||||
echo "[local-ci] Deploy flag detected: reloading PM2"
|
||||
npm run pm2:reload || (echo "[local-ci] npm run pm2:reload failed, attempting pm2 reload directly" && pm2 reload database/pm2.config.js || true)
|
||||
fi
|
||||
|
||||
echo "[local-ci] Finished successfully"
|
||||
Reference in New Issue
Block a user