-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (57 loc) · 2.58 KB
/
Copy pathcommon.vitest.yml
File metadata and controls
58 lines (57 loc) · 2.58 KB
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
name: Vitest Tests
on:
workflow_call:
inputs:
working-directory:
type: string
description: "The working directory for the job, e.g. apps/dolly-frontend (without leading/trailing slash)."
required: true
default: "apps/dolly-frontend"
workflow_dispatch:
inputs:
working-directory:
description: "The working directory for the job, e.g. apps/dolly-frontend (without leading/trailing slash)."
required: true
default: "apps/dolly-frontend"
jobs:
vitest:
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: "latest"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: lts/*
cache: pnpm
cache-dependency-path: ${{ inputs.working-directory || github.event.inputs.working-directory }}/src/main/js/pnpm-lock.yaml
- name: Install dependencies
working-directory: ${{ inputs.working-directory || github.event.inputs.working-directory }}/src/main/js
run: |
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
pnpm install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Playwright version
id: playwright-version
working-directory: ${{ inputs.working-directory || github.event.inputs.working-directory }}/src/main/js
run: echo "version=$(pnpm list @playwright/test --json | jq -r '.[0].devDependencies["@playwright/test"].version // .[0].dependencies["@playwright/test"].version')" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
- name: Install Playwright Browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: ${{ inputs.working-directory || github.event.inputs.working-directory }}/src/main/js
run: pnpm exec playwright install --with-deps chromium
- name: Run Vitest/RTL tests
working-directory: ${{ inputs.working-directory || github.event.inputs.working-directory }}/src/main/js
run: pnpm run test:vitest-run