Skip to content

test: add test for https://github.com/vitejs/vite/pull/14127 (#41) #198

test: add test for https://github.com/vitejs/vite/pull/14127 (#41)

test: add test for https://github.com/vitejs/vite/pull/14127 (#41) #198

Workflow file for this run

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:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: show docker version
run: docker version
- name: show docker compose version
run: docker compose version
- name: install pnpm
uses: pnpm/action-setup@v4
- name: setup Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: pnpm
- name: Install deps
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 --filter ./tests @playwright/test | jq --raw-output '.[0].devDependencies["@playwright/test"].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 --filter ./tests @playwright/test | jq --raw-output '.[0].devDependencies[\"@playwright/test\"].version')"
echo "PLAYWRIGHT_VERSION=$env:PLAYWRIGHT_VERSION" >> $env:GITHUB_ENV
- name: Cache Playwright's binary
uses: actions/cache@v4
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
# does not need to explictly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
run: pnpm playwright install chromium
working-directory: tests
- name: Run tests
run: pnpm run test
working-directory: tests
test-local-node-modules:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: show docker version
run: docker version
- name: show docker compose version
run: docker compose version
- name: install pnpm
uses: pnpm/action-setup@v4
- name: setup Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
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@v4
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
working-directory: tests
- name: Run tests
# only run container used tests
run: pnpm run test-local-node-modules with-proxy
working-directory: tests