Skip to content

Add preview publishing #414

Add preview publishing

Add preview publishing #414

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- "master"
tags:
- "!**"
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
checkout-and-setup:
name: Checkout and setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
lint:
name: Lint
needs: checkout-and-setup
runs-on: ubuntu-latest
steps:
- run: pnpm install --frozen-lockfile
- run: pnpm run test:lint
# format:
# name: Format
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: pnpm/action-setup@v4
# with:
# version: 9
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: "pnpm"
# - run: pnpm install --frozen-lockfile
# - run: pnpm run test:format
# build-and-test-node:
# name: "[node] build and test"
# runs-on: ubuntu-latest
# timeout-minutes: 20
# strategy:
# fail-fast: false
# matrix:
# node-version: [18, 20]
# steps:
# - uses: actions/checkout@v4
# - uses: pnpm/action-setup@v4
# with:
# version: 9
# - name: Build and test using Node.js v${{ matrix.node-version }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}
# cache: "pnpm"
# - run: pnpm install --frozen-lockfile
# - run: pnpm -r build
# - run: pnpm run test:unit
# build-and-test-bun:
# name: "[bun] build and test"
# runs-on: ubuntu-latest
# timeout-minutes: 20
# strategy:
# fail-fast: false
# matrix:
# bun-version: ["latest"]
# steps:
# - uses: actions/checkout@v4
# - uses: pnpm/action-setup@v4
# with:
# version: 9
# - name: Build and test using bun ${{ matrix.bun-version }}
# uses: oven-sh/setup-bun@v1
# with:
# bun-version: ${{ matrix.bun-version }}
# - run: bun run pnpm install --frozen-lockfile
# - run: bun run pnpm -r build
# - run: bun run test:unit
# build-and-test-other-envs:
# name: "[happy-dom, edge-runtime] test"
# runs-on: ubuntu-latest
# timeout-minutes: 20
# strategy:
# fail-fast: false
# steps:
# - uses: actions/checkout@v4
# - uses: pnpm/action-setup@v4
# with:
# version: 9
# - name: Build using Node.js v20
# uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: "pnpm"
# - run: pnpm install --frozen-lockfile
# - run: pnpm -r build
# - name: Test using happy-dom
# run: pnpm run test:unit-browser
# - name: Test using edge-runtime
# run: pnpm run test:unit-edge
# publish-preview:
# name: "Publish preview"
# runs-on: ubuntu-latest
# needs: build-and-test-node
# if: success()
# timeout-minutes: 20
# strategy:
# fail-fast: false
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Setup pnpm
# uses: pnpm/action-setup@v4
# with:
# version: 9
# - name: Enable corepack
# uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: "pnpm"
# - name: Install dependencies
# run: pnpm install --frozen-lockfile
# - name: Build
# run: pnpm -r build
# - name: Publish
# run: pnpx pkg-pr-new publish './packages/*' './plugins/*' --no-template --pnpm --compact