Skip to content

Commit 2ecc0b5

Browse files
authored
Merge pull request #961
* chore(32662): add matrix-based jobs for Percy * chore(32662): trigger frontend * chore(32662): disable old workflow * chore(32662): fix working directory [?] * chore(32662): fix working directory [?] * Revert "chore(32662): fix working directory [?]" * Revert "chore(32662): fix working directory [?]" * chore(32662): fix run * chore(32662): fix artefact * chore(32662): add e2e and component support * chore(32662): use cypress action * chore(32662): fix names * chore(32662): fix nonce * chore(32662): fix command * chore(32662): combine CodeCov and Percy * chore(32662): fix checkout * chore(32662): fix names and clean workflow * chore(32662): remove deprecated workflow
1 parent 4d4a908 commit 2ecc0b5

File tree

3 files changed

+59
-77
lines changed

3 files changed

+59
-77
lines changed

.github/workflows/check-frontend-visual.yml

-64
This file was deleted.

.github/workflows/check-frontend.yml

+57-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# 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
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3-
41
name: Frontend - React Testing Pyramid
52

63
on:
@@ -18,6 +15,7 @@ defaults:
1815

1916
jobs:
2017
lint:
18+
name: Linting
2119
runs-on: ubuntu-latest
2220
steps:
2321
- name: 👓 Checkout repository
@@ -35,6 +33,7 @@ jobs:
3533
run: pnpm lint:eslint
3634

3735
unit_tests:
36+
name: Unit Tests
3837
runs-on: ubuntu-latest
3938
steps:
4039
- name: 👓 Checkout repository
@@ -57,6 +56,7 @@ jobs:
5756
retention-days: 1
5857

5958
build_production:
59+
name: Build Production
6060
runs-on: ubuntu-latest
6161
steps:
6262
- name: 👓 Checkout repository
@@ -78,6 +78,7 @@ jobs:
7878
retention-days: 1
7979

8080
lighthouse:
81+
name: Lighthouse Performance
8182
runs-on: ubuntu-latest
8283
needs: [ build_production ]
8384
steps:
@@ -99,20 +100,37 @@ jobs:
99100
uploadArtifacts: true # save results as an action artifacts
100101
configPath: 'hivemq-edge-frontend/.lighthouserc.cjs'
101102

103+
percy_prepare:
104+
name: Percy (initialise parallel)
105+
runs-on: ubuntu-latest
106+
outputs:
107+
LOCAL_NONCE: ${{ steps.percy.outputs.nonce }}
108+
steps:
109+
- name: 👓 Checkout repository
110+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
111+
- id: percy
112+
run: |
113+
echo "nonce=$(date +'%s')" >> "$GITHUB_OUTPUT"
114+
102115
cypress_matrix:
103116
runs-on: ubuntu-latest
104117
continue-on-error: true
105-
needs: [ build_production ]
118+
needs: [ build_production, percy_prepare ]
119+
env:
120+
LOCAL_NONCE: ${{ needs.percy_prepare.outputs.LOCAL_NONCE }}
121+
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
122+
outputs:
123+
LOCAL_NONCE: ${{ env.LOCAL_NONCE }}
106124
strategy:
107125
matrix:
108126
cypress: [
109-
{ component: false, spec: "./cypress/e2e/**/*", lcov_target: "E2E" },
110-
{ component: true, spec: "./src/components/**/*", lcov_target: "Components" },
111-
{ component: true, spec: "./src/extensions/**/*", lcov_target: "Extensions" },
112-
{ component: true, spec: "./src/modules/!(Workspace)**/*", lcov_target: "Modules" },
113-
{ component: true, spec: "./src/modules/Workspace/**/*", lcov_target: "Workspace" }
127+
{ component: false, spec: "./cypress/e2e/**/*", target: "E2E" },
128+
{ component: true, spec: "./src/components/**/*", target: "Components" },
129+
{ component: true, spec: "./src/extensions/**/*", target: "Extensions" },
130+
{ component: true, spec: "./src/modules/!(Workspace)**/*", target: "Modules" },
131+
{ component: true, spec: "./src/modules/Workspace/**/*", target: "Workspace" }
114132
]
115-
name: Cypress - ${{ matrix.cypress.lcov_target }}
133+
name: Cypress - ${{ matrix.cypress.target }}
116134
steps:
117135
- name: 👓 Checkout repository
118136
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@@ -136,22 +154,26 @@ jobs:
136154
spec: ${{ matrix.cypress.spec }}
137155
start: pnpm preview --port 3000
138156
working-directory: ./hivemq-edge-frontend/
157+
command-prefix: 'npx percy exec --parallel'
139158
quiet: true
159+
env:
160+
PERCY_PARALLEL_NONCE: ${{ env.LOCAL_NONCE }}
161+
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
140162

141163
# after the test, store videos
142-
- name: 💾 Upload Cypress - ${{ matrix.cypress.lcov_target }} videos
164+
- name: 💾 Upload Cypress - ${{ matrix.cypress.target }} videos
143165
if: failure()
144166
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
145167
with:
146-
name: cypress-${{ matrix.cypress.lcov_target }}-videos
168+
name: cypress-${{ matrix.cypress.target }}-videos
147169
path: hivemq-edge-frontend/cypress/videos
148170
if-no-files-found: ignore
149171
retention-days: 1
150172

151173
- name: 💾 Upload Cypress Code Coverage
152174
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
153175
with:
154-
name: lcov-cypress-${{ matrix.cypress.lcov_target }}
176+
name: lcov-cypress-${{ matrix.cypress.target }}
155177
path: hivemq-edge-frontend/coverage-cypress/lcov.info
156178
if-no-files-found: ignore
157179
retention-days: 1
@@ -186,3 +208,25 @@ jobs:
186208
-Dsonar.verbose=false
187209
env:
188210
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
211+
212+
percy_finalise:
213+
name: Percy (finalise)
214+
needs: [ cypress_matrix ]
215+
runs-on: ubuntu-latest
216+
env:
217+
LOCAL_NONCE: ${{ needs.cypress_matrix.outputs.LOCAL_NONCE }}
218+
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
219+
steps:
220+
- name: 👓 Checkout repository
221+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
222+
223+
- name: 🏗️ Setup node environment
224+
uses: ./.github/actions/setup_node
225+
with:
226+
working-directory: ./hivemq-edge-frontend/
227+
run-install: true
228+
229+
- run: npx percy build:finalize
230+
env:
231+
PERCY_PARALLEL_NONCE: ${{ env.LOCAL_NONCE }}
232+
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

hivemq-edge-frontend/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ Together. they contain - and enforce - parts of the testing pyramid for frontend
139139

140140
### Percy - Visual testing
141141

142+
See github actions
143+
142144
### Lighthouse - Performance testing
143145

144146
### SonarQube Cloud

0 commit comments

Comments
 (0)