Skip to content

Commit 0cdf549

Browse files
committed
feat: build before e2e test
1 parent 8155947 commit 0cdf549

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

.github/workflows/test-e2e.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,24 @@ on:
1414
default: 3
1515

1616
jobs:
17+
prepare-shards:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
shard-array: ${{ steps.generate-shards.outputs.shard-array }}
21+
steps:
22+
- name: Generate shard array
23+
id: generate-shards
24+
run: |
25+
shards=$(seq 1 ${{ inputs.shard-total }} | jq -s -c 'map(tonumber)')
26+
echo "shard-array=$shards" >> $GITHUB_OUTPUT
27+
1728
test:
29+
needs: prepare-shards
1830
runs-on: ubuntu-latest
1931
strategy:
2032
matrix:
2133
include: ${{ fromJson(inputs.matrix-include) }}
22-
shard: [1, 2, 3]
34+
shard: ${{ fromJson(needs.prepare-shards.outputs.shard-array) }}
2335
name: Test ${{ matrix.locale }} (Shard ${{ matrix.shard }})
2436
steps:
2537
- name: Checkout code
@@ -37,8 +49,19 @@ jobs:
3749
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
3850
vercel_token: ${{ secrets.VERCEL_TOKEN }}
3951

40-
- name: Run E2E Tests
52+
- uses: ./.github/actions/vercel-build
53+
with:
54+
environment: production
55+
prodFlag: --prod
56+
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
57+
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
58+
vercel_token: ${{ secrets.VERCEL_TOKEN }}
59+
60+
- name: Install E2E Dependencies
4161
run: |
4262
pnpm --filter @next-i18n/docs playwright:install
63+
64+
- name: Run E2E Tests
65+
run: |
4366
echo "Running tests for ${{ matrix.locale }} (Shard ${{ matrix.shard }}/${{ inputs.shard-total }})"
4467
pnpm --filter @next-i18n/docs test:e2e --shard ${{ matrix.shard }}/${{ inputs.shard-total }}

.github/workflows/update-docs-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
uses: ./.github/workflows/test-e2e.yml
3232
with:
3333
matrix-include: ${{ needs.check-changes.outputs.matrix-include }}
34-
shard-total: 3
34+
shard-total: 5
3535
secrets: inherit
3636

3737
deploy-and-update-index:

apps/docs/playwright.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import env from '@next/env';
12
import { defineConfig, devices } from '@playwright/test';
3+
env.loadEnvConfig(process.cwd());
24

35
export default defineConfig({
46
testDir: './tests/e2e',
@@ -18,7 +20,7 @@ export default defineConfig({
1820
},
1921
],
2022
webServer: {
21-
command: 'pnpm dev --port 7878',
23+
command: 'pnpm start --port 7878',
2224
url: 'http://localhost:7878',
2325
reuseExistingServer: !process.env.CI,
2426
timeout: 120 * 1000,

0 commit comments

Comments
 (0)