Skip to content

test(28703): fix tests #2694

test(28703): fix tests

test(28703): fix tests #2694

Workflow file for this run

# 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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@fa0a91b85d4f404e444e00e005971372dc801d16 # 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: false
# after the test run completes store videos
- name: 💾 Upload Component videos
if: failure()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@fa0a91b85d4f404e444e00e005971372dc801d16 # 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: false
- name: 💾 Upload E2E videos
if: failure()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Download artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: application
path: hivemq-edge/src/frontend/dist
- name: 🚥 Run Lighthouse audits
uses: treosh/lighthouse-ci-action@2f8dda6cf4de7d73b29853c3f29e73a01e297bd8 # v12
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"