name: Verify

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  backend:
    runs-on: ubuntu-latest
    container: sfja/h5-mst-ci:latest
    steps:
    - uses: actions/checkout@v6
    - name: Check
      working-directory: ./backend
      run: make check
    - name: Build
      working-directory: ./backend
      run: make all
    - name: Test
      working-directory: ./backend
      run: make test

  game:
    runs-on: ubuntu-latest
    container: sfja/h5-mst-ci:latest
    steps:
    - uses: actions/checkout@v6
    - run: rustup default stable
    - name: Check
      working-directory: ./game
      run: cargo check
    - name: Clippy
      working-directory: ./game
      continue-on-error: true
      run: cargo clippy
    - name: Build
      working-directory: ./game
      run: cargo build
    - name: Test
      working-directory: ./game
      run: cargo test

  skateboard:
    runs-on: ubuntu-latest
    container: espressif/idf:release-v5.5
    steps:
    - uses: actions/checkout@v6
    - name: Build
      shell: bash
      working-directory: ./skateboard
      # https://github.com/espressif/esp-bsp/blob/master/.github/workflows/build-run-applications.yml
      run: |
        export IDF_PYTHON_CHECK_CONSTRAINTS=yes
        ${IDF_PATH}/install.sh --enable-ci
        source ${IDF_PATH}/export.sh
        idf.py build

