Skip to content

Commit e88f9d8

Browse files
committed
feat: add e2e test workflow
1 parent 30e68b6 commit e88f9d8

File tree

2 files changed

+52
-5
lines changed

2 files changed

+52
-5
lines changed

.github/workflows/test-e2e.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: E2E Tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
matrix-include:
7+
description: 'Matrix configuration for locales'
8+
required: true
9+
type: string
10+
shard-total:
11+
description: 'Total number of shards'
12+
required: false
13+
type: number
14+
default: 3
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
include: ${{ fromJson(inputs.matrix-include) }}
22+
shard: [1, 2, 3]
23+
name: Test ${{ matrix.locale }} (Shard ${{ matrix.shard }})
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 1
29+
30+
- uses: ./.github/actions/setup
31+
32+
- uses: ./.github/actions/vercel-pull
33+
with:
34+
environment: production
35+
prodFlag: --prod
36+
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
37+
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
38+
vercel_token: ${{ secrets.VERCEL_TOKEN }}
39+
40+
- name: Run E2E Tests
41+
run: |
42+
echo "Running tests for ${{ matrix.locale }} (Shard ${{ matrix.shard }}/${{ inputs.shard-total }})"
43+
pnpm --filter @next-i18n/docs test:e2e --shard ${{ matrix.shard }}/${{ inputs.shard-total }}

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,17 @@ jobs:
2525
uses: ./.github/actions/check-locale-changes
2626
with:
2727
trigger-type: docs-pr
28+
test:
29+
needs: check-changes
30+
if: needs.check-changes.outputs.has-changes == 'true' && startsWith(github.head_ref, 'docs/')
31+
uses: ./.github/workflows/test-e2e.yml
32+
with:
33+
matrix-include: ${{ needs.check-changes.outputs.matrix-include }}
34+
shard-total: 3
35+
secrets: inherit
2836

2937
deploy-and-update-index:
30-
needs: check-changes
38+
needs: [check-changes, test]
3139
if: needs.check-changes.outputs.has-changes == 'true' && startsWith(github.head_ref, 'docs/')
3240
runs-on: ubuntu-latest
3341
strategy:
@@ -47,10 +55,6 @@ jobs:
4755
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
4856
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
4957
vercel_token: ${{ secrets.VERCEL_TOKEN }}
50-
- name: Test
51-
run: |
52-
echo "Running tests for ${{ matrix.locale }}"
53-
pnpm --filter @next-i18n/docs test:e2e
5458
- uses: ./.github/actions/vercel-build
5559
with:
5660
environment: production

0 commit comments

Comments
 (0)