generated from Tim-W-James/react-ts-template
-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (76 loc) · 2.5 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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Test
on:
push:
branches: ["main"]
paths-ignore:
- "**.md"
- "**.txt"
- ".husky/**"
- ".vscode/**"
pull_request:
branches: ["main"]
paths-ignore:
- "**.md"
- "**.txt"
- ".husky/**"
- ".vscode/**"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
NODE_OPTIONS: "--max_old_space_size=4096"
jobs:
test:
name: Test 🔧
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0 # Required for Chromatic to retrieve git history
- name: Install pnpm 🔧
uses: pnpm/action-setup@v2.4.0
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }} 🔧
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install Dependencies 🔧
# --ignore-scripts for security
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Build 🚀
run: pnpm --if-present build
- name: Check for Vulnerabilities 🔧
# Don't fail CI if vulnerabilities are found
run: pnpm audit --production --audit-level=high || echo "Vulnerabilities found"
- name: Lint 🔧
run: pnpm --if-present lint
- name: Type Coverage 🔧
run: pnpm --if-present type-coverage
- name: Run Unit Tests 🔧
run: pnpm --if-present test
- name: Run E2E Tests 🔧
run: |
pnpm exec playwright install --with-deps
pnpm playwright test
- name: Save E2E Test Report 🔧
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Storybook Smoke Test 🔧
run: |
pnpm --if-present storybook:smoke-test
- name: Publish to Chromatic 🔧
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}