chore: optimize ci

This commit is contained in:
nathan
2025-10-03 08:52:50 +08:00
parent 3886fc4451
commit eb7ea7e11b

View File

@@ -16,8 +16,8 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
# Split tests across 4 parallel jobs for 4x speedup # Split tests across 2 parallel jobs for better reliability
shard: [1, 2, 3, 4] shard: [1, 2]
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -104,12 +104,19 @@ jobs:
docker compose pull appflowy_cloud gotrue ai appflowy_worker docker compose pull appflowy_cloud gotrue ai appflowy_worker
docker compose -f docker-compose-web-ci.yml up -d docker compose -f docker-compose-web-ci.yml up -d
# Optimized health check with timeout # Extended health check with detailed logging
echo "Waiting for backend services..." echo "Waiting for backend services..."
timeout 90 bash -c 'until curl -sf http://localhost/api/health > /dev/null 2>&1; do timeout 180 bash -c 'until curl -sf http://localhost/api/health > /dev/null 2>&1; do
echo "Waiting for backend... ($(date +%T))" echo "Waiting for backend... ($(date +%T))"
sleep 3 sleep 5
done' && echo "✓ Backend is ready" || (echo "❌ Backend failed to start" && exit 1) done' && echo "✓ Backend is ready" || (
echo "❌ Backend failed to start after 3 minutes"
echo "Docker container status:"
docker compose -f docker-compose-web-ci.yml ps
echo "Docker logs:"
docker compose -f docker-compose-web-ci.yml logs --tail=50
exit 1
)
# Cache build artifacts # Cache build artifacts
- name: Cache build - name: Cache build
@@ -136,14 +143,14 @@ jobs:
sleep 2 sleep 2
done' && echo "✓ Preview server is ready" || (echo "❌ Preview server failed to start" && exit 1) done' && echo "✓ Preview server is ready" || (echo "❌ Preview server failed to start" && exit 1)
- name: Run tests (shard ${{ matrix.shard }}/4) - name: Run tests (shard ${{ matrix.shard }}/2)
run: | run: |
pnpm cypress run \ pnpm cypress run \
--spec 'cypress/e2e/**/*.cy.ts' \ --spec 'cypress/e2e/**/*.cy.ts' \
--config video=false --config video=false
env: env:
CYPRESS_SHARD: ${{ matrix.shard }} CYPRESS_SHARD: ${{ matrix.shard }}
CYPRESS_TOTAL_SHARDS: 4 CYPRESS_TOTAL_SHARDS: 2
- name: Upload artifacts - name: Upload artifacts
if: always() if: always()