Skip to content

Chapter 3: Regular Expression #7

Chapter 3: Regular Expression

Chapter 3: Regular Expression #7

Workflow file for this run

name: Test
on:
pull_request:
branches:
- main
paths:
- '**.test.ts'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: latest
- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: latest
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Test
env:
NODE_OPTIONS: --max_old_space_size=6144
run: |
TEST_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...origin/${{ github.head_ref }} **/*.test.ts)
pnpm vitest --silent --run $TEST_FILES