chore: add e2e tests #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| SUPERUSER_API_KEY: 'test-superuser-api-key-for-e2e' | |
| REPLANE_ADMIN_API_PORT: 8084 | |
| REPLANE_EDGE_API_PORT: 8085 | |
| jobs: | |
| e2e: | |
| name: E2E Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Start services | |
| run: | | |
| docker compose -f docker-compose.e2e.yml up -d | |
| # Wait for services to be healthy | |
| echo "Waiting for services to be ready..." | |
| sleep 10 | |
| # Check if services are up | |
| for i in {1..30}; do | |
| if curl -sf http://localhost:$REPLANE_ADMIN_API_PORT/api/health > /dev/null 2>&1; then | |
| echo "Admin API is ready" | |
| break | |
| fi | |
| echo "Waiting for Admin API... ($i/30)" | |
| sleep 2 | |
| done | |
| for i in {1..30}; do | |
| if curl -sf http://localhost:$REPLANE_EDGE_API_PORT/api/health > /dev/null 2>&1; then | |
| echo "Edge API is ready" | |
| break | |
| fi | |
| echo "Waiting for Edge API... ($i/30)" | |
| sleep 2 | |
| done | |
| - name: Run E2E tests | |
| env: | |
| REPLANE_ADMIN_API_BASE_URL: http://localhost:${{ env.REPLANE_ADMIN_API_PORT }} | |
| REPLANE_EDGE_API_BASE_URL: http://localhost:${{ env.REPLANE_EDGE_API_PORT }} | |
| run: pnpm test:e2e | |
| - name: Show logs on failure | |
| if: failure() | |
| run: docker compose -f docker-compose.e2e.yml logs | |
| - name: Cleanup | |
| if: always() | |
| run: docker compose -f docker-compose.e2e.yml down -v |