name: PlatformIO Build

on:
  push:
    branches: [ master ]
    paths:
      - 'esp32/**'  
  pull_request:
    branches: [ master ]
    paths:
        - 'esp32/**'  
    
permissions:
  contents: read

env:
  DEVICE: esp32cam

jobs:
  build:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./esp32
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.x'
    - name: Install PlatformIO
      run: pip install platformio
    - name: Build using PlatformIO
      run: pio run -e $DEVICE