diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4df9ada9e3..976cfebe5e 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -13,9 +13,107 @@ concurrency: cancel-in-progress: true jobs: - e2e: - uses: ./.github/workflows/run.yml - secrets: inherit + e2e-shards: + runs-on: ubuntu-latest if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository }} - with: - cmd: pnpm run setup && pnpm test:e2e + strategy: + fail-fast: false + matrix: + shard: [1, 2, 3, 4, 5] + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + persist-credentials: false + + - name: Collect versions + run: | + echo "nodejs_version=$(cat .tool-versions | grep 'nodejs' | cut -d ' ' -f 2)" >> "$GITHUB_ENV" + echo "pnpm_version=$(cat .tool-versions | grep 'pnpm' | cut -d ' ' -f 2)" >> "$GITHUB_ENV" + + - uses: pnpm/action-setup@v4 + with: + version: ${{ env.pnpm_version }} + + - uses: actions/setup-node@v5 + with: + node-version: ${{ env.nodejs_version }} + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Setup and run e2e shard ${{ matrix.shard }} + run: | + set -eux + pnpm run setup + export DATABASE_URL=postgres://postgres:pw@localhost:5432/test + E2E_TEST=true pnpm vitest run -c vitest/vitest.e2e.config.mts --no-file-parallelism --shard=${{ matrix.shard }}/5 --reporter=blob --outputFile=e2e-results-${{ matrix.shard }}.blob || true + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + INFERENCE_NET_API_KEY: ${{ secrets.INFERENCE_NET_API_KEY }} + TOGETHER_AI_API_KEY: ${{ secrets.TOGETHER_AI_API_KEY }} + GOOGLE_AI_STUDIO_API_KEY: ${{ secrets.GOOGLE_AI_STUDIO_API_KEY }} + CLOUD_RIFT_API_KEY: ${{ secrets.CLOUD_RIFT_API_KEY }} + MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} + X_AI_API_KEY: ${{ secrets.X_AI_API_KEY }} + GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} + DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} + PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }} + NOVITA_AI_API_KEY: ${{ secrets.NOVITA_AI_API_KEY }} + MOONSHOT_API_KEY: ${{ secrets.MOONSHOT_API_KEY }} + ALIBABA_API_KEY: ${{ secrets.ALIBABA_API_KEY }} + NEBIUS_API_KEY: ${{ secrets.NEBIUS_API_KEY }} + Z_AI_API_KEY: ${{ secrets.Z_AI_API_KEY }} + ROUTEWAY_API_KEY: ${{ secrets.ROUTEWAY_API_KEY }} + + - name: Upload shard results + if: always() + uses: actions/upload-artifact@v4 + with: + name: e2e-results-${{ matrix.shard }} + path: e2e-results-${{ matrix.shard }}.blob + retention-days: 1 + if-no-files-found: ignore + + e2e: + runs-on: ubuntu-latest + needs: e2e-shards + if: always() + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + persist-credentials: false + + - name: Collect versions + run: | + echo "nodejs_version=$(cat .tool-versions | grep 'nodejs' | cut -d ' ' -f 2)" >> "$GITHUB_ENV" + echo "pnpm_version=$(cat .tool-versions | grep 'pnpm' | cut -d ' ' -f 2)" >> "$GITHUB_ENV" + + - uses: pnpm/action-setup@v4 + with: + version: ${{ env.pnpm_version }} + + - uses: actions/setup-node@v5 + with: + node-version: ${{ env.nodejs_version }} + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Download all shard results + uses: actions/download-artifact@v4 + with: + path: ./e2e-results + pattern: e2e-results-* + + - name: Merge reports and show final results + run: | + # Create .vitest-reports directory and move blob files there + mkdir -p .vitest-reports + find ./e2e-results -name "*.blob" -exec mv {} .vitest-reports/ \; + # Merge reports - this will fail if tests failed, providing the final status + pnpm vitest run -c vitest/vitest.e2e.config.mts --merge-reports