esp-hub75 0.2.2

A Rust driver for HUB75 LED matrix displays on ESP32 microcontrollers
name: CI

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

# Cancel any currently running workflows from the same PR, branch, or
# tag when a new workflow is triggered.
#
# https://stackoverflow.com/a/66336834
concurrency:
  cancel-in-progress: true
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

env:
  CARGO_TARGET_DIR: ${{ github.workspace }}/target
  CARGO_TERM_COLOR: always
  DEFMT_LOG: trace

jobs:
  build:
    name: Build Examples
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: "-D warnings -C link-arg=-Tlinkall.x -C link-arg=-Tdefmt.x"
    strategy:
      fail-fast: false
      matrix:
        target: [esp32, esp32s3, esp32c6]
        features: [log, defmt]
        include:
          - target: esp32
            rust_target: xtensa-esp32-none-elf
            toolchain: esp
            example: i2s_parallel
            cargo_unstable: "-Zbuild-std=core,alloc"
          - target: esp32
            rust_target: xtensa-esp32-none-elf
            toolchain: +esp
            example: i2s_parallel_latch
            cargo_unstable: "-Zbuild-std=core,alloc"
          - target: esp32s3
            rust_target: xtensa-esp32s3-none-elf
            toolchain: +esp
            example: lcd_cam
            cargo_unstable: "-Zbuild-std=core,alloc"
          - target: esp32s3
            rust_target: xtensa-esp32s3-none-elf
            toolchain: +esp
            example: lcd_cam_latch
            cargo_unstable: "-Zbuild-std=core,alloc"
          - target: esp32c6
            rust_target: riscv32imac-unknown-none-elf
            toolchain: ""
            example: parl_io
            cargo_unstable: ""
    steps:
      - uses: actions/checkout@v4

      # Install the Rust toolchain for Xtensa devices:
      - name: Install Xtensa toolchain
        uses: esp-rs/xtensa-toolchain@v1.5
        with:
          ldproxy: false
          version: 1.86.0.0

      # Install the Rust stable toolchain for RISC-V devices:
      - name: Install RISC-V toolchain
        uses: dtolnay/rust-toolchain@v1
        with:
          target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
          toolchain: stable
          components: rust-src

      - uses: Swatinem/rust-cache@v2
        with:
          prefix-key: "ci-${{ matrix.target }}"
          cache-all-crates: true
  
      - name: Build examples
        run: |
          cargo ${{ matrix.toolchain }} build --target ${{ matrix.rust_target }} --example ${{ matrix.example }} --features "${{ matrix.target }},${{ matrix.features }}" ${{ matrix.cargo_unstable }}