Skip to content

build: add performance-tests #20

build: add performance-tests

build: add performance-tests #20

Workflow file for this run

name: Performance Test
on:
pull_request:
types: [opened, synchronize, labeled]
branches:
- main
push:
branches:
- main
jobs:
build-react-day-picker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 6.16.0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
- name: Create pnpm store directory
run: mkdir -p ~/.pnpm-store
- name: Cache node_modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build project
run: pnpm build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: rdp-dist
path: dist
run-performance-test:
needs: [build-react-day-picker]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Chrome
uses: browser-actions/setup-chrome@v1
id: setup-chrome
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 6.16.0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: rdp-dist
path: dist
- name: Create pnpm store directory
run: mkdir -p ~/.pnpm-store
- name: Cache node_modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Start server
run: pnpm --filter performance-tests start-server &
env:
CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
- name: Wait for server to start
run: pnpx wait-on http://localhost:4173 --timeout 10000
- name: Create reports directory
run: mkdir -p ./reports
- name: Run performance test
run: node performance-tests/capture.mjs
env:
CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
HEADLESS: true
- name: Upload reports
uses: actions/upload-artifact@v4
with:
name: reports
path: ./reports