# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Build script

env:
  NODE_VERSION: '22.x'

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    - name: Setup Node.js
      uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
      with:
        node-version: ${{ env.NODE_VERSION }}
        cache: 'yarn'
    - run: yarn install --frozen-lockfile
    - run: yarn lint
    - run: yarn test:unit
    - run: yarn generate-ecs-types
    - run: yarn build
    - run: yarn test:integration
