xgl 0.2.2

Unified minimalist OpenGL 3.3 & WebGL abstractions.
Documentation
# Copyright (C) 2025 Daniel Mueller <deso@posteo.net>
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

name: Test

on:
  pull_request:
  push:
  workflow_call:

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1
  # Build with only line information enabled to decrease compilation
  # time and binary artifact sizes in CI, while still providing relevant
  # data in backtraces. This option is assumed to only have marginal
  # effects on the generated code, likely only in terms of section
  # arrangement. See
  # https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo
  RUSTFLAGS: '-A unknown_lints -D warnings -C debuginfo=line-tables-only'

jobs:
  build:
    name: Build [${{ matrix.rust }}, ${{ matrix.profile }}]
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        rust: [stable]
        profile: [dev, release]
    steps:
    - uses: actions/checkout@v6
    - run: sudo apt-get install --yes --no-install-recommends libgl-dev
    - uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ matrix.rust }}
    - name: Build ${{ matrix.profile }}
      run: cargo build --profile=${{ matrix.profile }} --all-targets --workspace
  build-wasm32:
    name: Build for wasm32
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
    - uses: dtolnay/rust-toolchain@stable
      with:
        target: wasm32-unknown-unknown
    - run: cargo build --target=wasm32-unknown-unknown --workspace
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - run: sudo apt-get install --yes --no-install-recommends libgl-dev xvfb libxkbcommon-x11-0
      - uses: dtolnay/rust-toolchain@stable
      - name: Test
        shell: bash
        run: |
          export DISPLAY=:1
          Xvfb $DISPLAY -screen 0 1280x720x24 &> /tmp/xvfb.log &
          cargo test
  clippy:
    name: Lint with clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          target: wasm32-unknown-unknown
          components: clippy
      - run: cargo clippy --no-deps --all-targets --workspace
      - run: cargo clippy --no-deps --workspace --target=wasm32-unknown-unknown
  rustfmt:
    name: Check Rust code formatting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt
      - run: cargo +nightly fmt -- --check
  rustdoc:
    name: Generate documentation
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: '-D warnings'
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@nightly
      - run: cargo doc --workspace --no-deps --document-private-items