-
Notifications
You must be signed in to change notification settings - Fork 27
173 lines (144 loc) · 5.45 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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# 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:
paths:
- hivemq-edge/src/frontend/**
- .github/workflows/frontend-cli.yml
- .github/actions/setup_node/action.yml
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
working-directory: ./hivemq-edge/src/frontend/
# Cancel previous workflow on a follow-up push event
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: 👓 Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: 🏗️ Setup node environment
uses: ./.github/actions/setup_node
with:
working-directory: ./hivemq-edge/src/frontend/
- name: 🧪 Run Prettier
run: pnpm lint:prettier
- name: 🧪 Run ESLint
run: pnpm lint:eslint
unit_tests:
runs-on: ubuntu-latest
steps:
- name: 👓 Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: 🏗️ Setup node environment
uses: ./.github/actions/setup_node
with:
working-directory: ./hivemq-edge/src/frontend/
- name: 🧪 Run Test
run: pnpm test
build_production:
runs-on: ubuntu-latest
steps:
- name: 👓 Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: 🏗️ Setup node environment
uses: ./.github/actions/setup_node
with:
working-directory: ./hivemq-edge/src/frontend/
- name: 🏗️ Build Application
run: pnpm run build
- name: Upload artifact
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: application
path: hivemq-edge/src/frontend/dist
retention-days: 1
component_tests:
runs-on: ubuntu-latest
needs: [ build_production ]
steps:
- name: 👓 Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: 🏗️ Setup node environment
uses: ./.github/actions/setup_node
with:
working-directory: ./hivemq-edge/src/frontend/
run-install: true
- name: Download artifact
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: application
path: hivemq-edge/src/frontend/dist
- name: 🧪 Run Cypress Component
uses: cypress-io/github-action@v6
with:
component: true
start: pnpm preview
working-directory: ./hivemq-edge/src/frontend/
quiet: true
# after the test run completes store videos
- name: 💾 Upload Component videos
if: failure()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: cypress-component-videos
path: hivemq-edge/src/frontend/cypress/videos
if-no-files-found: ignore
retention-days: 1
e2e_tests:
runs-on: ubuntu-latest
needs: [ build_production ]
steps:
- name: 👓 Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: 🏗️ Setup node environment
uses: ./.github/actions/setup_node
with:
working-directory: ./hivemq-edge/src/frontend/
run-install: true
- name: Download artifact
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: application
path: hivemq-edge/src/frontend/dist
- name: 🧪 Run Cypress E2E
uses: cypress-io/github-action@v6
with:
start: pnpm preview --port 3000
working-directory: ./hivemq-edge/src/frontend/
quiet: true
- name: 💾 Upload E2E videos
if: failure()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
with:
name: cypress-e2e-videos
path: hivemq-edge/src/frontend/cypress/videos
if-no-files-found: ignore
retention-days: 1
lighthouse:
runs-on: ubuntu-latest
needs: [ build_production ]
steps:
- name: 👓 Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: Download artifact
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4
with:
name: application
path: hivemq-edge/src/frontend/dist
- name: 🚥 Run Lighthouse audits
uses: treosh/lighthouse-ci-action@72f881228236981b625ed765b928efb1786a1f55 # v11
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: 📸 Run Percy visual tests
# run: echo "Check the Percy tests on the other workflow"