generated from theholocron/react-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (117 loc) · 4.16 KB
/
test.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Test
on: # yamllint disable-line rule:truthy
- push
jobs:
unit:
name: Run tests and collect coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
- uses: actions/setup-node@v4
name: Setup Node.js @v20
with:
cache: npm
node-version: 20.x
- run: npm ci
name: Install dependencies
- run: npx playwright install --with-deps
name: Install Playwright
- run: npm run build:storybook -- --quiet --output-dir=docs
name: Build Storybook
- run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server docs --port 6006 --silent" \
"npx wait-on tcp:6006 && npm run test:storybook -- --coverage"
name: Run tests with coverage
- uses: codecov/codecov-action@v4
name: Upload results to Codecov
with:
token: ${{ secrets.CODECOV_TOKEN }}
# Run visual and composition tests with Chromatic
visual-and-composition:
name: Test Visual and Composition
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
- uses: actions/setup-node@v4
name: Setup Node.js @v20
with:
cache: npm
node-version: 20.x
- run: npm ci
name: Install dependencies
- uses: chromaui/action@v1
name: Publish to Chromatic
with:
buildScriptName: build:storybook
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
# Run interaction and accessibility tests
interaction-and-accessibility:
name: Test Interactions and Accessibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
- uses: actions/setup-node@v4
name: Setup Node.js @v20
with:
cache: npm
node-version: 20.x
- run: npm ci
name: Install dependencies
- run: npx playwright install --with-deps
name: Install Playwright
- run: npm run build:storybook -- --quiet --output-dir=docs
name: Build Storybook
- run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server docs --port 6006 --silent" \
"npx wait-on tcp:6006 && npm run test:storybook"
name: Serve Storybook and run tests
# Run user flow tests with Cypress
user-flow:
name: Test User Flow
runs-on: ubuntu-latest
strategy:
fail-fast: false # https://github.com/cypress-io/github-action/issues/48
matrix:
containers: [1, 2] # Uses 2 parallel instances
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
- uses: actions/setup-node@v4
name: Setup Node.js @v20
with:
cache: npm
node-version: 20.x
- run: npm ci
name: Install dependencies
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action
- uses: cypress-io/github-action@v6
name: Cypress run
with:
# Starts web server for E2E tests - replace with your own server invocation
# https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server
start: npm run dev
wait-on: "http://localhost:3000" # Waits for above
# Records to Cypress Cloud
# https://docs.cypress.io/guides/cloud/projects#Set-up-a-project-to-record
record: true
parallel: true # Runs test in parallel using settings above
env:
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}