mirror of https://github.com/vuejs/vitepress
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.1 KiB
74 lines
2.1 KiB
name: Test
|
|
|
|
env:
|
|
# 7 GiB by default on GitHub, setting to 6 GiB
|
|
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
|
|
NODE_OPTIONS: --max-old-space-size=6144
|
|
# install playwright binary manually (because pnpm only runs install script once)
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [14, 16]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.0.1
|
|
with:
|
|
version: 7.0.1
|
|
|
|
- name: Set node version to ${{ matrix.node_version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node_version }}
|
|
cache: 'pnpm'
|
|
|
|
- name: Install deps
|
|
run: pnpm install
|
|
|
|
# Install playwright's binary under custom directory to cache
|
|
- name: Set Playwright path (non-windows)
|
|
if: runner.os != 'Windows'
|
|
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
|
|
- name: Set Playwright path (windows)
|
|
if: runner.os == 'Windows'
|
|
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
|
|
|
|
- name: Cache Playwright's binary
|
|
uses: actions/cache@v3
|
|
with:
|
|
# Playwright removes unused browsers automatically
|
|
# So does not need to add playwright version to key
|
|
key: ${{ runner.os }}-playwright-bin-v1
|
|
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
|
|
|
|
- name: Install Playwright
|
|
# does not need to explictly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
|
|
run: pnpm playwright install chromium
|
|
|
|
- name: Build
|
|
run: pnpm run build
|
|
|
|
- name: Lint
|
|
run: pnpm run lint-fail
|
|
|
|
- name: Test unit
|
|
run: pnpm run test-unit
|
|
|
|
- name: Test serve
|
|
run: pnpm run test-serve
|
|
|
|
- name: Test build
|
|
run: pnpm run test-build
|