name: Arduino Pong CI

on:
  push:
    branches: [ master ]
    paths:
      - 'arduino_pong.ino'
      - 'Makefile'
      - '.github/workflows/ci.yml'
      - 'src/*.cpp'
      - 'src/*.h'

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout Code
        uses: actions/checkout@v6

      - name: Setup Arduino CLI
        #uses: arduino/setup-arduino-cli@v2
        shell: bash
        run: |
          curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
          echo "./bin" >> $GITHUB_PATH

      - name: Install UNO R4 Core
        run: |
          arduino-cli core update-index
          arduino-cli core install arduino:renesas_uno
          
      - name: Compile Sketch (via Makefile)
        shell: bash
        run: make prepare_and_compile
