embedded-3dgfx 0.3.0

3D graphics rendering for embedded systems (fork of embedded-gfx by Kezii)
Documentation
name: Rust

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

env:
  CARGO_TERM_COLOR: always
  TELEMETRY_MAX_RECORD_DRAW_COMMANDS: "3"
  TELEMETRY_MAX_EXECUTE_COMMANDS_TOTAL: "4"
  TELEMETRY_MAX_EXECUTE_DRAW_COMMANDS: "3"
  TELEMETRY_STRESS_MAX_RECORD_DRAW_COMMANDS: "24"
  TELEMETRY_STRESS_MAX_EXECUTE_COMMANDS_TOTAL: "25"
  TELEMETRY_STRESS_MAX_EXECUTE_DRAW_COMMANDS: "24"
  TELEMETRY_FAILSOFT_MAX_RECORD_DRAW_COMMANDS: "1"
  TELEMETRY_FAILSOFT_MAX_EXECUTE_COMMANDS_TOTAL: "2"
  TELEMETRY_FAILSOFT_MAX_EXECUTE_DRAW_COMMANDS: "1"
  TELEMETRY_FAILSOFT_EXPECTED_BUDGET_KIND: "MeshesPerFrame"

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - uses: Swatinem/rust-cache@v2
    - name: cargo check
      run: cargo check --lib --all-features

  no-alloc-frame-path:
    name: No-Alloc Frame Path Guard
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Guard frame path allocation usage
      run: python3 .github/scripts/check_no_alloc_frame_path.py

  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - uses: Swatinem/rust-cache@v2
    - name: Install SDL2
      run: sudo apt-get update && sudo apt-get install -y libsdl2-dev
    - name: Unit tests
      run: cargo test --lib
    - name: Integration tests
      run: cargo test --test integration_tests
    - name: Telemetry budget guard
      run: cargo test --test integration_tests test_ci_telemetry_snapshot_ -- --nocapture 2>&1 | .github/scripts/check_telemetry_budget.py

  embedded-budget:
    name: Embedded Budget (${{ matrix.row_width_feature }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        row_width_feature:
          - row_width_96
          - row_width_160
          - row_width_240
          - row_width_320
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - uses: Swatinem/rust-cache@v2
    - name: no_std-style library check
      run: cargo check --lib --no-default-features --features ${{ matrix.row_width_feature }}
    - name: no_std-style clippy
      run: cargo clippy --lib --no-default-features --features ${{ matrix.row_width_feature }}
    - name: Constrained telemetry budget guard
      run: cargo test --test integration_tests test_ci_telemetry_snapshot_ --no-default-features --features ${{ matrix.row_width_feature }} -- --nocapture 2>&1 | .github/scripts/check_telemetry_budget.py

  profile-budget:
    name: Profile Budget (${{ matrix.caps_profile }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        caps_profile:
          - m3
          - m4
          - m33
          - m55
    env:
      EMBEDDED_3DGFX_CAPS: ${{ matrix.caps_profile }}
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - uses: Swatinem/rust-cache@v2
    - name: Profile telemetry budget guard
      run: cargo test --test integration_tests test_ci_telemetry_snapshot_ -- --nocapture 2>&1 | .github/scripts/check_telemetry_budget.py

  m55-perf-budget:
    name: M55 Perf Budget
    runs-on: ubuntu-latest
    env:
      EMBEDDED_3DGFX_CAPS: m55
      TELEMETRY_MAX_RECORD_DRAW_COMMANDS: "4"
      TELEMETRY_MAX_EXECUTE_COMMANDS_TOTAL: "5"
      TELEMETRY_MAX_EXECUTE_DRAW_COMMANDS: "4"
      TELEMETRY_STRESS_MAX_RECORD_DRAW_COMMANDS: "24"
      TELEMETRY_STRESS_MAX_EXECUTE_COMMANDS_TOTAL: "25"
      TELEMETRY_STRESS_MAX_EXECUTE_DRAW_COMMANDS: "24"
      TELEMETRY_FAILSOFT_MAX_RECORD_DRAW_COMMANDS: "1"
      TELEMETRY_FAILSOFT_MAX_EXECUTE_COMMANDS_TOTAL: "2"
      TELEMETRY_FAILSOFT_MAX_EXECUTE_DRAW_COMMANDS: "1"
      TELEMETRY_FAILSOFT_EXPECTED_BUDGET_KIND: "MeshesPerFrame"
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - uses: Swatinem/rust-cache@v2
    - name: M55 perf telemetry budget guard
      run: cargo test --test integration_tests test_ci_telemetry_snapshot_ -- --nocapture 2>&1 | .github/scripts/check_telemetry_budget.py

  fmt:
    name: Formatting
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
      with:
        components: rustfmt
    - name: cargo fmt
      run: cargo fmt --all -- --check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
      with:
        components: clippy
    - uses: Swatinem/rust-cache@v2
    - name: cargo clippy
      run: cargo clippy --lib --all-features

  examples:
    name: Examples
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - uses: Swatinem/rust-cache@v2
    - name: Install SDL2
      run: sudo apt-get update && sudo apt-get install -y libsdl2-dev
    - name: Build examples
      run: cargo build --examples

  asset-budget:
    name: Asset Budget Report
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Asset budget report
      run: python3 .github/scripts/asset_budget_report.py