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.
vitepress/.github/workflows/test.yml

74 lines
2.1 KiB

4 years ago
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:
4 years ago
jobs:
test:
runs-on: ubuntu-latest
4 years ago
strategy:
matrix:
node-version: [14, 16, 18]
4 years ago
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v3
4 years ago
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 explicitly 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