on: [push, pull_request]
name: Build and Test
jobs:
  build:
    name: Build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node-version: [14, 16, 18]
        os: [macos-latest, ubuntu-latest, windows-latest]
        typescript-version: [4.6, 4.7, 4.8]

    steps:
      - uses: actions/checkout@master

      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
          cache: yarn

      - name: Install Yarn
        run: npm install -g yarn

      - name: Set resolutions to correct typescript version
        uses: jossef/action-set-json-field@v2
        with:
          file: package.json
          field: resolutions
          value: "{ \"typescript\": \"${{ matrix.typescript-version }}\"}"
          parse_json: true

      # for yarn3
      # - name: Set Typescript version
      #  run: yarn set resolution typescript ${{ matrix.typescript-version }}

      - name: Install
        run: yarn install --ignore-scripts --no-lockfile

      - name: Output ts version
        run: yarn tsc --version

      - name: Build
        run: yarn run build

      - name: Lint
        run: yarn run lint

      - name: Test
        run: yarn run test

on: [push, pull_request]
name: Build and Test
jobs:
  build:
    name: Build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node-version: [14, 16, 18]
        os: [macos-latest, ubuntu-latest, windows-latest]
        typescript-version: [4.6, 4.7, 4.8]

    steps:
      - uses: actions/checkout@master

      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
          cache: yarn

      - name: Install Yarn
        run: npm install -g yarn

      - name: Set resolutions to correct typescript version
        uses: jossef/action-set-json-field@v2
        with:
          file: package.json
          field: resolutions
          value: "{ \"typescript\": \"${{ matrix.typescript-version }}\"}"
          parse_json: true

      # for yarn3
      # - name: Set Typescript version
      #  run: yarn set resolution typescript ${{ matrix.typescript-version }}

      - name: Install
        run: yarn install --ignore-scripts --no-lockfile

      - name: Output ts version
        run: yarn tsc --version

      - name: Output packages version
        run: yarn list

      - name: Build
        run: yarn run build

      - name: Lint
        run: yarn run lint

      - name: Test
        run: yarn run test

Add new test stage to list package version
chore: Add new test stage to list package version
