name: Style and build test

on:
    push:
        branches: [master]
    pull_request:
        branches: [master]

jobs:
    tsc:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2
            - uses: pnpm/action-setup@v2
              with:
                  version: latest
            - name: Set up Node.js
              uses: actions/setup-node@v3
              with:
                  node-version: 22
                  check-latest: true
            - run: pnpm i
            - run: npx tsc
    eslint:
        needs: tsc
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2
            - uses: pnpm/action-setup@v2
              with:
                  version: latest
            - name: Set up Node.js
              uses: actions/setup-node@v3
              with:
                  node-version: 22
                  check-latest: true
            - run: pnpm i
            - run: pnpm run eslint
    prettier:
        needs: tsc
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2
            - uses: pnpm/action-setup@v2
              with:
                  version: latest
            - name: Set up Node.js
              uses: actions/setup-node@v3
              with:
                  node-version: 22
                  check-latest: true
            - run: pnpm i
            - run: pnpm run prettier
    build-test:
        needs: [eslint, prettier, tsc]
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2
            - uses: pnpm/action-setup@v2
              with:
                  version: latest
            - name: Set up Node.js
              uses: actions/setup-node@v3
              with:
                  node-version: 22
                  check-latest: true
            - run: pnpm i
            - run: pnpm run test
