name: CI
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
jobs:
  build:
    name: Build, Lint and Test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macOS-latest
        node_version:
          - 16
          - 18
    steps:
      - name: checkout code repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Install pnpm
        uses: pnpm/action-setup@v2

      - name: Setup node version
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node_version }}
          cache: 'pnpm'

      - run: pnpm install
      - run: pnpm build
      - run: pnpm ts-check
      - run: pnpm lint
      - run: pnpm run test
      - run: pnpm -F example-react build
