# This is a basic workflow to help you get started with Actions

name: Test Build

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  pull_request:
    # The branches below must be a subset of the branches above
    branches: [ "main", "next", "development" ]
  schedule:
    - cron: '25 2 * * 4'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    environment: Development
    if: "!contains(github.event.head_commit.message, 'build skip')"
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    timeout-minutes: 80

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
      - name: Setup kernel for react native, increase watchers
        run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
      - uses: actions/setup-node@v2
        with:
          node-version: '20.13.1'

      - name: Cache pnpm modules
        uses: actions/cache@v2
        with:
          path: ~/.pnpm-store
          key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
          restore-keys: |
            ${{ runner.os }}-

      - name: Nestjs
        run: npm i -g @nestjs/cli
      
      - uses: pnpm/action-setup@v2.0.1
        env:
          CI: false
        with:
          version: 8.9.0
          run_install: true