Skip to content

fix: add annotations for tree shaking #510

fix: add annotations for tree shaking

fix: add annotations for tree shaking #510

Workflow file for this run

name: Tests
on:
push:
branches:
- 'main'
pull_request: {}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.packages }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
packages:
- 'packages/**'
- 'targets/**'
- 'cypress/**'
- 'yarn.lock'
- '.github/workflows/checks.yml'
- '.github/workflows/tests.yml'
build:
needs: changes
if: ${{ needs.changes.outputs.packages == 'true' }}
name: 'Build'
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.x']
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install
run: yarn install --immutable
- name: Build
run: yarn build-ci --filter=!@react-spring/docs
- name: Pack
run: yarn package
- uses: actions/upload-artifact@v3
with:
name: animated
path: packages/animated/package.tgz
- uses: actions/upload-artifact@v3
with:
name: core
path: packages/core/package.tgz
- uses: actions/upload-artifact@v3
with:
name: rafz
path: packages/rafz/package.tgz
- uses: actions/upload-artifact@v3
with:
name: shared
path: packages/shared/package.tgz
- uses: actions/upload-artifact@v3
with:
name: types
path: packages/types/package.tgz
- uses: actions/upload-artifact@v3
with:
name: web
path: targets/web/package.tgz
test-unit:
name: 'Test:unit'
needs: [build]
if: ${{ needs.changes.outputs.packages == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.x']
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install
run: yarn install --immutable
- name: Build
run: yarn build-ci
- name: Test
run: yarn test:unit
test-types:
name: 'Test:types with TS ${{ matrix.ts }}'
needs: [build]
if: ${{ needs.changes.outputs.packages == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.x']
ts: ['4.5', '4.6', '4.7', '4.8', '4.9']
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install
run: yarn install --immutable
- name: Install TypeScript ${{ matrix.ts }}
run: yarn add typescript@${{ matrix.ts }}
- name: Build
run: yarn build-ci
- name: Test
run: |
yarn tsc --version
yarn test:ts
test-e2e:
needs: [build]
if: ${{ needs.changes.outputs.packages == 'true' }}
name: 'Test:E2E'
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.x']
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install
run: yarn install --immutable
- name: Build
run: yarn build-ci
- name: Test
run: yarn test:e2e
test-published-artifact:
needs: [build]
if: ${{ needs.changes.outputs.packages == 'true' }}
name: 'Test:publish'
runs-on: ubuntu-latest
strategy:
matrix:
# keep at 16 because of webpack 4
node: ['16.x']
example:
[
'cra4',
'cra5',
'next',
'vite',
'node-standard',
'node-esm',
'are-the-types-wrong',
]
defaults:
run:
working-directory: ./.github/publish-ci/${{ matrix.example }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install
run: yarn install --immutable
- name: Remove existing @react-spring/web
run: yarn remove @react-spring/web
- uses: actions/download-artifact@v3
with:
path: ./.github/publish-ci/${{ matrix.example }}
- name: Check folder contents
run: ls -l .
- name: Install RS build artifacts
run: yarn add ./web/package.tgz ./animated/package.tgz ./core/package.tgz ./rafz/package.tgz ./shared/package.tgz ./types/package.tgz
- name: Show installed RS versions
run: yarn info @react-spring/web && yarn why @react-spring/web
- name: Build example
run: yarn build
- name: Run test step
run: yarn test
if: matrix.example != 'are-the-types-wrong'
- name: Run test step (attw)
# Ignore "FalseCJS" errors in the `attw` job
run: yarn test -n FalseCJS
if: matrix.example == 'are-the-types-wrong'