name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    
    - name: Use Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '18.x'
        cache: 'npm'
        
    - name: Install dependencies
      run: npm ci

    - name: Lint
      run: npm run lint

    - name: Format Check
      run: npx prettier --check "src/**/*.{ts,js,json}"

    - name: Build
      run: npm run build

    - name: Test
      run: npm test
