Skip to content

test

test #430

Workflow file for this run

name: UI tests
on:
pull_request:
types: [opened, synchronize]
branches:
- 'dev'
paths:
- '.github/workflows/tests-on-pr.yml'
- 'ui/**/*.js'
- 'ui/package.json'
- 'ui/playground/package.json'
jobs:
build:
permissions:
contents: read # to fetch code (actions/checkout)
runs-on: ubuntu-latest
# Check if the build cache exists, and if it does, do nothing else.
# Otherwise, run the build and cache it.
name: Build the packages
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm i
- name: Build the UI package
working-directory: ui
run: pnpm build
- name: Upload UI build artifact
uses: actions/upload-artifact@v4
with:
name: ui-build
path: ui/dist
- name: Build vite-plugin package
working-directory: vite-plugin
run: pnpm build
- name: Upload vite-plugin build artifact
uses: actions/upload-artifact@v4
with:
name: vite-plugin-build
path: vite-plugin/dist
tests:
# If the build pipeline doesn't succeed, we don't need to run tests at all
needs: build
permissions:
contents: read # to fetch code (actions/checkout)
actions: read # to correctly identify workflow run
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui
strategy:
fail-fast: false
name: Tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm i
- name: Download UI build artifact
uses: actions/download-artifact@v4
with:
name: ui-build
path: ui/dist
- name: Download vite-plugin build artifact
uses: actions/download-artifact@v4
with:
name: vite-plugin-build
path: vite-plugin/dist
- name: Run tests
run: pnpm test:workflow
with:
working-directory: ui
# Upload required artifacts to be used in tests-on-pr-report.yml
- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test-results
path: ui/testing/test-results
- name: Upload GitHub Actions event data
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: event-data
path: ${{ github.event_path }}
overwrite: true