name: Build with ESP-IDF

on:
  workflow_dispatch:
  pull_request:
  push:
    paths:
      - "src/**"
      - "examples/ESP_IDF_TouchDrvExample/**"
      - "examples/ESP_IDF_SensorExamples/**"
      - ".github/workflows/esp-idf.yml"

jobs:
  esp-idf-build:
    strategy:
      matrix:
        idf_ver: ["latest"]
    runs-on: ubuntu-latest

    container: espressif/idf:${{ matrix.idf_ver }}
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: "recursive"
      - name: Build ESP_IDF_TouchDrvExample
        shell: bash
        run: |
          pwd
          . ${IDF_PATH}/export.sh
          cd examples/ESP_IDF_TouchDrvExample
          idf.py build
      - name: Build ESP_IDF_SensorExamples
        shell: bash
        run: |
          pwd
          . ${IDF_PATH}/export.sh
          cd examples/ESP_IDF_SensorExamples
          idf.py build
