Skip to content

chore: upgrade vitest #184

chore: upgrade vitest

chore: upgrade vitest #184

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Lint
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout codes
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Lint codes
run: deno lint
build:
name: Build
strategy:
matrix:
os: [ubuntu-latest]
node: [18.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout codes
uses: actions/checkout@v4
- name: Setup deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Enable corepack
run: corepack enable
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: bun install
- name: Build codes
run: npm run build
test:
name: Test
strategy:
matrix:
os: [ubuntu-latest]
node: [18.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout codes
uses: actions/checkout@v4
- name: Setup deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: bun install
# NOTE: avoid https://github.com/intlify/utils/actions/runs/6573605958/job/17857030689?pr=31#step:8:48
# vitest-environment-miniflare tries to load dist/index.cjs and work with vitest...
- name: Build codes
run: npm run build
- name: Test
run: npm test
e2e:
name: E2E
strategy:
matrix:
os: [ubuntu-latest]
node: [18.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout codes
uses: actions/checkout@v4
- name: Setup deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: bun install
- name: Build codes
run: npm run build
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L91
# 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="$(bun run ./scripts/playwright-version.ts)"
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
PLAYWRIGHT_VERSION="$(bun run ./scripts/playwright-version.ts)"
echo "PLAYWRIGHT_VERSION=$env:PLAYWRIGHT_VERSION" >> $env:GITHUB_ENV
- name: Cache Playwright's binary
uses: actions/cache@v3
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 explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
run: bun x playwright install chromium
- name: Run test
run: ./scripts/e2e.sh
edge-release:
name: Edge Release
needs:
- lint
- build
- test
- e2e
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [18]
steps:
- name: Checkout codes
uses: actions/checkout@v4
- name: Setup deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Setup bun
uses: oven-sh/setup-bun@v1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: bun install
- name: Build
run: npm run build
- name: Release Edge
if: |
github.event_name == 'push' &&
!startsWith(github.event.head_commit.message, '[skip-release]') &&
!startsWith(github.event.head_commit.message, 'chore') &&
!startsWith(github.event.head_commit.message, 'release') &&
!startsWith(github.event.head_commit.message, 'docs')
run: ./scripts/release.sh
env:
NPM_TOKEN: ${{secrets.NPM_ORG_TOKEN}}
EDGE_RELEASE: 'true'