name: Build the PlatformIO Project

on:
  push:
    paths:
      - "ePaper/**"
  pull_request:
    paths:
      - "ePaper/**"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - uses: actions/cache@v3
        with:
          path: |
            ~/.cache/pip
            ~/.platformio/.cache
          key: ${{ runner.os }}-pio

      - uses: actions/setup-python@v4
        with:
          python-version: "3.9"

      - name: Install PlatformIO Core
        run: pip install --upgrade platformio

      - name: Static code analysis
        run: pio check -d $PWD/ePaper

      - name: Build bare metal
        run: pio run -d $PWD/ePaper
