mirror of
https://github.com/pmndrs/valtio.git
synced 2026-03-27 01:28:56 +00:00
52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
name: Test Multiple Builds
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
|
|
jobs:
|
|
test_multiple_builds:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build: [cjs, esm]
|
|
env: [development] # [development, production]
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
|
|
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
|
with:
|
|
node-version: 'lts/*'
|
|
cache: 'pnpm'
|
|
- run: pnpm install
|
|
- run: pnpm run build
|
|
- name: Patch for DEV-ONLY
|
|
if: ${{ matrix.env == 'development' }}
|
|
run: |
|
|
sed -i~ "s/it[.a-zA-Z]*('\[DEV-ONLY\]/it('/" tests/*.ts tests/*.tsx
|
|
sed -i~ "s/it[.a-zA-Z]*('\[PRD-ONLY\]/it.skip('/" tests/*.ts tests/*.tsx
|
|
- name: Patch for PRD-ONLY
|
|
if: ${{ matrix.env == 'production' }}
|
|
run: |
|
|
sed -i~ "s/it[.a-zA-Z]*('\[PRD-ONLY\]/it('/" tests/*.ts tests/*.tsx
|
|
sed -i~ "s/it[.a-zA-Z]*('\[DEV-ONLY\]/it.skip('/" tests/*.ts tests/*.tsx
|
|
- name: Patch for CJS
|
|
if: ${{ matrix.build == 'cjs' }}
|
|
run: |
|
|
sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\1.js')/" vitest.config.mts
|
|
- name: Patch for ESM
|
|
if: ${{ matrix.build == 'esm' }}
|
|
run: |
|
|
sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\/esm\1.mjs')/" vitest.config.mts
|
|
sed -i~ "1s/^/import.meta.env.MODE='${NODE_ENV}';/" tests/*.ts tests/*.tsx
|
|
env:
|
|
NODE_ENV: ${{ matrix.env }}
|
|
- name: Test ${{ matrix.build }} ${{ matrix.env }}
|
|
run: |
|
|
pnpm run test:spec
|
|
env:
|
|
NODE_ENV: ${{ matrix.env }}
|