fix: do not set process.browser
globally
#185
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml | |
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" | |
# Remove default permissions of GITHUB_TOKEN for security | |
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs | |
permissions: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: ${{ github.event_name != 'push' }} | |
jobs: | |
lint: | |
# autofix workflow will be triggered instead for PRs | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- run: corepack enable | |
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Lint | |
run: pnpm lint | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- run: corepack enable | |
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
# Install playwright's binary under custom directory to cache | |
- name: (non-windows) Set Playwright path and Get playwright version | |
if: runner.os != 'Windows' | |
run: | | |
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV | |
PLAYWRIGHT_VERSION="$(pnpm ls --depth 0 --json -w playwright | jq --raw-output '.[0].unsavedDependencies["playwright"].version')" | |
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | |
- name: (windows) Set Playwright path and Get playwright version | |
if: runner.os == 'Windows' | |
run: | | |
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV | |
$env:PLAYWRIGHT_VERSION="$(pnpm ls --depth 0 --json -w playwright | jq --raw-output '.[0].unsavedDependencies[\"playwright\"].version')" | |
echo "PLAYWRIGHT_VERSION=$env:PLAYWRIGHT_VERSION" >> $env:GITHUB_ENV | |
- name: Cache Playwright's binary | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 | |
with: | |
key: ${{ runner.os }}-playwright-bin-v1-${{ env.PLAYWRIGHT_VERSION }} | |
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} | |
restore-keys: | | |
${{ runner.os }}-playwright-bin-v1- | |
- name: Install Playwright | |
run: pnpm playwright-core install chromium | |
- name: Prepare build environment | |
run: pnpm dev:prepare | |
- name: Build module | |
run: pnpm prepack | |
- name: Test types | |
run: pnpm test:types | |
- name: Test examples | |
run: pnpm test:examples |