name: Checks

on:
  - pull_request

jobs:
  setup:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 1

      - name: Setup Pnpm and Install
        uses: seepine/action-setup-pnpm@v1

  eslint:
    needs: setup
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 1

      - name: Setup Pnpm and Install
        uses: seepine/action-setup-pnpm@v1

      - name: Eslint Test
        run: npx eslint --ext ".vue,.js,.jsx,.ts,.tsx" src/ --max-warnings=0

  tslint:
    needs: setup
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 1

      - name: Setup Pnpm and Install
        uses: seepine/action-setup-pnpm@v1

      - name: Tslint Test
        run: pnpm type-check

  commit-lint:
    needs: setup
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 10

      - name: Setup Pnpm and Install
        uses: seepine/action-setup-pnpm@v1

      - name: Commit lint
        run: npx commitlint --to HEAD --verbose

  build:
    needs: setup
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 1

      - name: Setup Pnpm and Install
        uses: seepine/action-setup-pnpm@v1

      - name: Build
        run: pnpm build
