chore: update packages and test snapshots #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
setup: | |
name: Setup | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 7 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Cache packages | |
uses: actions/cache@v3 | |
with: | |
path: | | |
packages/zarm-cli/dist | |
packages/bem/lib | |
packages/zarm-icons/lib | |
key: setup-${{ github.sha }} | |
- name: Install dependencies | |
run: pnpm install | |
- name: Compile | |
run: pnpm --filter @zarm-design/* run build | |
lint: | |
needs: [setup] | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 7 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- name: Restore node_modules Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
packages/**/node_modules | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Restore packages Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
packages/zarm-cli/dist | |
packages/bem/lib | |
packages/zarm-icons/lib | |
key: setup-${{ github.sha }} | |
- name: Lint | |
run: pnpm run lint | |
test-cli: | |
needs: [setup] | |
name: Test @zarm-design/cli on Node.js | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18, 16, 14, 12, 10] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 7 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- name: Restore Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
packages/**/node_modules | |
key: setup-${{ github.sha }} | |
- name: Test | |
run: pnpm --filter @zarm-design/cli run test | |
test: | |
needs: [setup] | |
name: Test zarm | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
react: ['16', '17', '18'] | |
module: ['dom', 'dist'] | |
env: | |
REACT: ${{ matrix.react }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 7 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- name: Restore Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
packages/**/node_modules | |
packages/zarm-cli/dist | |
packages/bem/lib | |
packages/zarm-icons/lib | |
key: setup-${{ github.sha }} | |
- name: Install React v16 | |
if: ${{ matrix.react == '16' }} | |
run: pnpm --filter zarm run install-react-16 | |
- name: Install React v18 | |
if: ${{ matrix.react == '18' }} | |
run: pnpm --filter zarm run install-react-18 | |
- name: Compile | |
if: ${{ matrix.module == 'dist' }} | |
env: | |
NODE_OPTIONS: --max_old_space_size=4096 | |
run: pnpm --filter zarm run build:umd | |
- name: Check dist | |
if: ${{ matrix.module == 'dist' }} | |
run: pnpm --filter zarm run filecheck | |
- name: Check bundlesize | |
if: ${{ matrix.module == 'dist' }} | |
run: pnpm --filter zarm run bundlesize | |
env: | |
BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE_GITHUB_TOKEN }} | |
- name: Test | |
if: ${{ matrix.module == 'dom' }} | |
run: pnpm --filter zarm run coverage | |
- name: Coverage | |
if: ${{ matrix.module == 'dom' && matrix.react == '17' }} | |
run: bash <(curl -s https://codecov.io/bash) |