mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
* ci(.github/workflows/lint-and-type.yml): add matrix strategy for parallel execution * ci(.github/workflows/lint-and-type.yml): set 'fail-fast' to 'false' * ci(.github/workflows): change jobs name * ci(.github/workflows): add test.yml * ci(.github/workflows/test.yml): add if condition * ci(.github/workflows/test-old-typescript.yml): rename job to 'test_old_typescript' * ci(.github/workflows/test.yml): remove matrix strategy * ci(.github/workflows/test.yml): add comment in build script * ci(.github/workflows/test.yml): change test script to sequentially
52 lines
1.6 KiB
YAML
52 lines
1.6 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@v4
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v4
|
|
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/*.tsx
|
|
sed -i~ "s/it[.a-zA-Z]*('\[PRD-ONLY\]/it.skip('/" tests/*.tsx
|
|
- name: Patch for PRD-ONLY
|
|
if: ${{ matrix.env == 'production' }}
|
|
run: |
|
|
sed -i~ "s/it[.a-zA-Z]*('\[PRD-ONLY\]/it('/" tests/*.tsx
|
|
sed -i~ "s/it[.a-zA-Z]*('\[DEV-ONLY\]/it.skip('/" 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=import.meta.env||{};import.meta.env.MODE='${NODE_ENV}';/" tests/*.tsx
|
|
env:
|
|
NODE_ENV: ${{ matrix.env }}
|
|
- name: Test ${{ matrix.build }} ${{ matrix.env }}
|
|
run: |
|
|
pnpm run test:spec
|
|
env:
|
|
NODE_ENV: ${{ matrix.env }}
|