-
Notifications
You must be signed in to change notification settings - Fork 27
106 lines (88 loc) · 3.46 KB
/
frontend-cli.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
# 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://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Frontend - React Testing Pyramid
on:
push:
branches:
- "**" # matches every branch
paths:
- hivemq-edge/src/frontend/**
pull_request:
branches: [master]
paths:
- hivemq-edge/src/frontend/**
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./hivemq-edge/src/frontend/
strategy:
matrix:
node-version: [18.16.0]
steps:
- name: 👓 Checkout repository
uses: actions/checkout@v3
- name: 🚚 Setup pnpm
uses: pnpm/[email protected]
with:
version: 8.4.0
- name: 🔻 Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: 📦 Install dependencies
run: pnpm install
- name: 🏗️ Build Application
run: pnpm run build
- name: 🧪 Run Prettier
run: pnpm lint:prettier
- name: 🧪 Run ESLint
run: pnpm lint:eslint
- name: 🧪 Run Test
run: pnpm test
- name: 🧪 Run Cypress E2E
uses: cypress-io/github-action@v5
with:
working-directory: ./hivemq-edge/src/frontend/
start: pnpm dev
# after the test run completes store videos
- name: 💾 Upload E2E videos
uses: actions/upload-artifact@v3
with:
name: cypress-e2e-videos
path: hivemq-edge/src/frontend/cypress/videos
if-no-files-found: ignore
- name: 🧪 Run Cypress Component
uses: cypress-io/github-action@v5
with:
working-directory: ./hivemq-edge/src/frontend/
component: true
start: pnpm dev
# after the test run completes store videos
- name: 💾 Upload Component videos
uses: actions/upload-artifact@v3
with:
name: cypress-component-videos
path: hivemq-edge/src/frontend/cypress/videos
if-no-files-found: ignore
- name: 📸 Run Percy visual tests
run: echo "Check the Percy tests on the other workflow"
- name: 🚥 Run Lighthouse audits
uses: treosh/lighthouse-ci-action@v10
id: lighthouse
with:
temporaryPublicStorage: true # upload lighthouse report to the temporary storage
## budgetPath: ./budget.json # test performance budgets
uploadArtifacts: true # save results as an action artifacts
configPath: 'hivemq-edge/src/frontend/.lighthouserc.cjs'
- name: 💾 Job successful feedback
if: ${{ success() }}
run: |
echo '### Lighthouse results 🚦' >> $GITHUB_STEP_SUMMARY
echo "Performance: ${{ fromJSON(steps.lighthouse.outputs.manifest)[0].summary.performance }}" >> $GITHUB_STEP_SUMMARY
echo "Accessibility: ${{ fromJSON(steps.lighthouse.outputs.manifest)[0].summary.accessibility }}" >> $GITHUB_STEP_SUMMARY
echo "Best-practices: ${{ fromJSON(steps.lighthouse.outputs.manifest)[0].summary.best-practices }}" >> $GITHUB_STEP_SUMMARY
echo "SEO: ${{ fromJSON(steps.lighthouse.outputs.manifest)[0].summary.seo }}" >> $GITHUB_STEP_SUMMARY