Skip to content

Commit 5c79b14

Browse files
committed
feat: add test in workflows
1 parent 47d7efb commit 5c79b14

File tree

6 files changed

+84
-40
lines changed

6 files changed

+84
-40
lines changed

.github/actions/vercel-build/action.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ inputs:
1717
runs:
1818
using: "composite"
1919
steps:
20-
- name: Pull Vercel Environment Information
21-
run: npx vercel pull --yes --environment=${{ inputs.environment }} --token=${{ inputs.vercel_token }}
22-
env:
23-
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
24-
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
25-
shell: bash
26-
- name: Echo Vercel Environment File
27-
run: |
28-
ls -l .vercel/.env*
29-
for f in .vercel/.env*; do
30-
echo "\n----- $f -----"
31-
cat "$f"
32-
done
33-
shell: bash
3420
- name: Build Project Artifacts
3521
run: npx vercel build ${{ inputs.prodFlag }} --token=${{ inputs.vercel_token }}
3622
env:

.github/actions/vercel-deploy/action.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ outputs:
2424
runs:
2525
using: "composite"
2626
steps:
27-
- name: Build with Vercel
28-
uses: ./.github/actions/vercel-build
29-
with:
30-
environment: ${{ inputs.environment }}
31-
prodFlag: ${{ inputs.prodFlag }}
32-
vercel_project_id: ${{ inputs.vercel_project_id }}
33-
vercel_org_id: ${{ inputs.vercel_org_id }}
34-
vercel_token: ${{ inputs.vercel_token }}
3527
- name: Deploy Project Artifacts
3628
id: vercel_deploy
3729
run: |
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Vercel Pull"
2+
description: "Pull Vercel environment variables"
3+
inputs:
4+
environment:
5+
description: "Vercel environment (production or preview)"
6+
required: true
7+
prodFlag:
8+
description: "Set to --prod for production deploys, empty for preview"
9+
required: false
10+
default: ""
11+
vercel_project_id:
12+
required: true
13+
vercel_org_id:
14+
required: true
15+
vercel_token:
16+
required: true
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Pull Vercel Environment Information
21+
run: npx vercel pull --yes --environment=${{ inputs.environment }} --token=${{ inputs.vercel_token }}
22+
env:
23+
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
24+
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
25+
shell: bash
26+
- name: Echo Vercel Environment File
27+
run: |
28+
ls -l .vercel/.env*
29+
for f in .vercel/.env*; do
30+
echo "\n----- $f -----"
31+
cat "$f"
32+
done
33+
shell: bash
34+
- name: Copy .vercel/.env.$environment.local
35+
shell: bash
36+
run: |
37+
cp .vercel/.env.${{ inputs.environment }}.local apps/docs/.env

.github/workflows/prerelease.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,20 @@ jobs:
8282
ref: ${{ github.head_ref }}
8383
- name: Log checked out commit
8484
run: git log -1
85-
- name: Setup Tools
86-
uses: ./.github/actions/setup
87-
- name: Deploy to Vercel (${{ matrix.locale }})
88-
id: deploy
85+
- uses: ./.github/actions/setup
86+
- uses: ./.github/actions/vercel-pull
87+
with:
88+
environment: preview
89+
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
90+
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
91+
vercel_token: ${{ secrets.VERCEL_TOKEN }}
92+
- uses: ./.github/actions/vercel-build
93+
with:
94+
environment: preview
95+
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
96+
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
97+
vercel_token: ${{ secrets.VERCEL_TOKEN }}
98+
- id: deploy
8999
uses: ./.github/actions/vercel-deploy
90100
with:
91101
environment: preview

.github/workflows/release.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,33 @@ jobs:
4848
uses: actions/checkout@v3
4949
with:
5050
fetch-depth: 1
51-
- name: Setup Tools
52-
uses: ./.github/actions/setup
53-
- name: Deploy to Vercel (${{ matrix.locale }})
54-
id: deploy
55-
uses: ./.github/actions/vercel-deploy
51+
- uses: ./.github/actions/setup
52+
- uses: ./.github/actions/vercel-pull
5653
with:
5754
environment: production
5855
prodFlag: --prod
5956
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
6057
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
6158
vercel_token: ${{ secrets.VERCEL_TOKEN }}
62-
- name: Copy .vercel/.env.production.local
63-
shell: bash
59+
- name: Test
6460
run: |
65-
cp .vercel/.env.production.local apps/docs/.env
61+
echo "Running tests for ${{ matrix.locale }}"
62+
pnpm --filter @next-i18n/docs test:e2e
63+
- uses: ./.github/actions/vercel-build
64+
with:
65+
environment: production
66+
prodFlag: --prod
67+
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
68+
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
69+
vercel_token: ${{ secrets.VERCEL_TOKEN }}
70+
- id: deploy
71+
uses: ./.github/actions/vercel-deploy
72+
with:
73+
environment: production
74+
prodFlag: --prod
75+
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
76+
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
77+
vercel_token: ${{ secrets.VERCEL_TOKEN }}
6678
- name: Update Search Index
6779
shell: bash
6880
run: pnpm run docs:update-search-index

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
- synchronize
88
branches:
99
- dev
10-
1110

1211
jobs:
1312
check-changes:
@@ -40,11 +39,19 @@ jobs:
4039
uses: actions/checkout@v3
4140
with:
4241
fetch-depth: 1
43-
- name: Setup Tools
44-
uses: ./.github/actions/setup
45-
- name: Build ${{ matrix.locale }}
46-
id: deploy
47-
uses: ./.github/actions/vercel-build
42+
- uses: ./.github/actions/setup
43+
- uses: ./.github/actions/vercel-pull
44+
with:
45+
environment: production
46+
prodFlag: --prod
47+
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
48+
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
49+
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
54+
- uses: ./.github/actions/vercel-build
4855
with:
4956
environment: production
5057
prodFlag: --prod

0 commit comments

Comments
 (0)