ci: 降低后端冒烟测试的内存占用
continuous-integration/drone/push Build is passing Details

This commit is contained in:
dongjf 2026-11-29 19:46:38 +08:00
parent a1dff7064e
commit 33b2e9e2ba
2 changed files with 8 additions and 3 deletions

View File

@ -2,6 +2,9 @@ kind: pipeline
type: docker
name: backend-ci
concurrency:
limit: 1
platform:
os: linux
arch: amd64

View File

@ -15,7 +15,9 @@ CREATE DATABASE itematlas_inventory OWNER atlas_inventory;
CREATE DATABASE itematlas_intake OWNER atlas_intake;
SQL
export SPRING_PROFILES_ACTIVE=local ATLAS_DB_PASSWORD="" JAVA_TOOL_OPTIONS="-Xmx192m"
# Three short-lived services share a small CI runner. Leave memory for PostgreSQL and other processes.
export SPRING_PROFILES_ACTIVE=local ATLAS_DB_PASSWORD=""
export JAVA_TOOL_OPTIONS="-Xms32m -Xmx128m -XX:+UseSerialGC -XX:ActiveProcessorCount=2 -XX:TieredStopAtLevel=1"
ATLAS_DB_USER=atlas_inventory ATLAS_DB_URL=jdbc:postgresql://postgres:5432/itematlas_inventory \
java -jar backend/inventory-service/target/app.jar > /tmp/atlas-inventory.log 2>&1 &
service_pids="$!"
@ -29,7 +31,7 @@ export ATLAS_SMOKE_INTAKE_DSN="postgresql://postgres@postgres/itematlas_intake"
export ATLAS_SMOKE_INVENTORY_DSN="postgresql://postgres@postgres/itematlas_inventory"
export ATLAS_SMOKE_METRIC_TARGETS="http://127.0.0.1:8080,http://127.0.0.1:8081,http://127.0.0.1:8082"
if ! python3 backend/tests/smoke.py; then
tail -80 /tmp/atlas-inventory.log /tmp/atlas-intake.log /tmp/atlas-gateway.log
tail -n 80 /tmp/atlas-inventory.log /tmp/atlas-intake.log /tmp/atlas-gateway.log
exit 1
fi
psql "$ATLAS_SMOKE_INVENTORY_DSN" -v ON_ERROR_STOP=1 <<'SQL'
@ -37,6 +39,6 @@ INSERT INTO native_account(username, subject, password_hash)
VALUES ('viewer', 'viewer', 'ci-basic-auth-fixture');
SQL
if ! python3 backend/tests/ios_experience_smoke.py; then
tail -80 /tmp/atlas-inventory.log /tmp/atlas-intake.log /tmp/atlas-gateway.log
tail -n 80 /tmp/atlas-inventory.log /tmp/atlas-intake.log /tmp/atlas-gateway.log
exit 1
fi