-
Notifications
You must be signed in to change notification settings - Fork 87
87 lines (82 loc) · 2.71 KB
/
e2e-next.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Next.js e2e test suite
on:
# pull_request:
# types: [opened, synchronize]
# push:
# branches: [main]
schedule:
- cron: '0 0 * * *'
env:
NEXT_SPLIT_API_ROUTES: true
jobs:
setup:
runs-on: ubuntu-latest
outputs:
test-files: ${{ steps['set-test-files'].outputs['test-files'] }}
steps:
- uses: actions/checkout@v3
- run: npm install
- id: set-test-files
name: Get test files
# Extracts the list of all test files as JSON and trims to be relative to the test dir to be easier to read
run:
echo "test-files=$(npx jest -c test/e2e/jest.config.js --listTests --json | jq -cM 'map(.[env.PWD | length +
10:])')" >> $GITHUB_OUTPUT
# echo "test-files=$(npx jest -c test/e2e/jest.config.all.js --listTests --json | jq -cM 'map(.[env.PWD | length
# + 10:])')" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
name: test (${{ matrix.test-file }})
needs:
- setup
strategy:
fail-fast: false
matrix:
# Creates a job for each chunk ID. This will be assigned one or more test files to run
test-file: ${{ fromJson(needs.setup.outputs['test-files']) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- run: npm install
- name: Install Netlify CLI
run: npm install -g netlify-cli
- name: Run tests
run: npx jest --reporters=jest-junit --reporters=default -c test/e2e/jest.config.all.js ${{ matrix.test-file }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_BOT_AUTH_TOKEN }}
NETLIFY_SITE_ID: 1d5a5c76-d445-4ae5-b694-b0d3f2e2c395
# RUN_SKIPPED_TESTS: true
- uses: actions/upload-artifact@v3
# upload test results
if: ${{ always() }}
name: Upload test results
with:
name: test-results
path: reports/jest-*.xml
report:
name: Report Next.js e2e test results
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- test
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: reports
- name: Combine reports
# The test reporter can handle multiple files, but these have random filenames so the output is better when combined
run: npx junit-report-merger test-results.xml reports/**/*.xml
- uses: phoenix-actions/test-reporting@v10
with:
name: Jest Tests
output-to: 'step-summary'
path: 'test-results.xml'
max-annotations: 49
reporter: jest-junit