diff --git a/.gitea/workflows/daily-check.yml b/.gitea/workflows/daily-check.yml index 3042fa418..358d42afc 100644 --- a/.gitea/workflows/daily-check.yml +++ b/.gitea/workflows/daily-check.yml @@ -108,7 +108,8 @@ jobs: set +e START_TIME=$(date +%s) chmod +x tests/e2e/api_smoke_test.sh - docker run --rm \ + CONTAINER_NAME="ci-test-$$" + docker create --name "$CONTAINER_NAME" \ -e BASE_URL=https://staging-api.xiaoxiajianji.com \ -e WEB_URL=https://staging.xiaoxiajianji.com \ -e TEST_USER="$STAGING_TEST_USER" \ @@ -117,11 +118,13 @@ jobs: -e PERF_CHECK_ENABLED=1 \ -e PERF_WARN_THRESHOLD_MS=500 \ -e PERF_FAIL_THRESHOLD_MS=3000 \ - -v "$PWD:/workspace" \ -w /workspace \ git.xiaoxiajianji.com/xiaoxia/base/playwright:v1.45.0-jammy \ - bash tests/e2e/api_smoke_test.sh 2>&1 | tee /tmp/staging-api-smoke.log + bash tests/e2e/api_smoke_test.sh 2>&1 + docker cp . "$CONTAINER_NAME:/workspace" + docker start -a "$CONTAINER_NAME" 2>&1 | tee /tmp/staging-api-smoke.log SMOKE_EXIT=${PIPESTATUS[0]} + docker rm "$CONTAINER_NAME" > /dev/null 2>&1 || true END_TIME=$(date +%s) ELAPSED=$((END_TIME - START_TIME)) @@ -147,14 +150,17 @@ jobs: run: | set +e START_TIME=$(date +%s) - docker run --rm \ + CONTAINER_NAME="ci-test-$$" + docker create --name "$CONTAINER_NAME" \ -e E2E_BASE_URL=https://staging.xiaoxiajianji.com \ -e E2E_API_BASE=https://staging-api.xiaoxiajianji.com/api/v1 \ - -v "$PWD:/workspace" \ -w /workspace/apps/web \ git.xiaoxiajianji.com/xiaoxia/base/playwright:v1.45.0-jammy \ - sh -lc "npm ci && npx playwright test --reporter=line e2e/test_auth.spec.ts e2e/test_asset.spec.ts e2e/test_project.spec.ts" 2>&1 | tee /tmp/staging-api-e2e.log + sh -lc "npm ci && npx playwright test --reporter=line e2e/test_auth.spec.ts e2e/test_asset.spec.ts e2e/test_project.spec.ts" 2>&1 + docker cp . "$CONTAINER_NAME:/workspace" + docker start -a "$CONTAINER_NAME" 2>&1 | tee /tmp/staging-api-e2e.log EXIT_CODE=${PIPESTATUS[0]} + docker rm "$CONTAINER_NAME" > /dev/null 2>&1 || true END_TIME=$(date +%s) ELAPSED=$((END_TIME - START_TIME)) @@ -218,16 +224,19 @@ jobs: run: | set +e START_TIME=$(date +%s) - docker run --rm --ipc=host \ + CONTAINER_NAME="ci-test-$$" + docker create --name "$CONTAINER_NAME" --ipc=host \ -e E2E_BASE_URL=https://staging.xiaoxiajianji.com \ -e E2E_API_BASE=https://staging-api.xiaoxiajianji.com/api/v1 \ -e E2E_BROWSER_CHANNEL=chromium \ -e PLAYWRIGHT_HEADLESS=1 \ - -v "$PWD:/workspace" \ -w /workspace/apps/web \ git.xiaoxiajianji.com/xiaoxia/base/playwright:v1.45.0-jammy \ - sh -lc 'npm ci && npx playwright test --reporter=line --project=chromium e2e/auth.spec.ts e2e/auth-guard.spec.ts e2e/core-upload.spec.ts e2e/core-generation.spec.ts e2e/core-titles.spec.ts' 2>&1 | tee /tmp/staging-e2e.log + sh -lc 'npm ci && npx playwright test --reporter=line --project=chromium e2e/auth.spec.ts e2e/auth-guard.spec.ts e2e/core-upload.spec.ts e2e/core-generation.spec.ts e2e/core-titles.spec.ts' 2>&1 + docker cp . "$CONTAINER_NAME:/workspace" + docker start -a "$CONTAINER_NAME" 2>&1 | tee /tmp/staging-e2e.log EXIT_CODE=${PIPESTATUS[0]} + docker rm "$CONTAINER_NAME" > /dev/null 2>&1 || true END_TIME=$(date +%s) ELAPSED=$((END_TIME - START_TIME))