glslint 0.5.0

A luma.gl/deck.gl-aware GLSL checker and language server
name: CI

# Build, lint, and test on every pull request; on main this runs inside the
# release workflow (workflow_call), which gates release-please on it, so a main
# push gets exactly one CI run and a release can never cut from a red tree. The
# toolchain channel comes from rust-toolchain.toml. glslint shells out to
# glslangValidator (the Khronos GLSL reference compiler), so CI installs
# glslang-tools to exercise the real validation path.

on:
  pull_request:
  workflow_call:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    env:
      RUSTC_WRAPPER: sccache
      SCCACHE_GHA_ENABLED: "true"
      CARGO_INCREMENTAL: "0"
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
        with:
          components: clippy, rustfmt
          cache: "false"
      - uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
      - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
        with:
          cache-targets: "false"
      - name: Install glslang (provides glslangValidator)
        run: sudo apt-get update && sudo apt-get install -y glslang-tools
      - name: Format
        run: cargo fmt --all --check
      - name: Clippy
        run: cargo clippy --all-targets --locked -- -D warnings
      - name: Test
        run: cargo test --locked
      - name: sccache stats
        if: ${{ always() }}
        run: sccache --show-stats

  npm:
    # Exercise the npm distribution end to end: lay out the packages, then run
    # the real binary through the wrapper's shim. Without this, a broken
    # resolver or a platform table that has drifted from the wrapper's
    # optionalDependencies would only surface after publishing.
    runs-on: ubuntu-latest
    timeout-minutes: 15
    env:
      RUSTC_WRAPPER: sccache
      SCCACHE_GHA_ENABLED: "true"
      CARGO_INCREMENTAL: "0"
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
        with:
          cache: "false"
      - uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
      - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
        with:
          cache-targets: "false"
      - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
        with:
          node-version: 'lts/*'
      - name: Check the drift guard without touching tracked files
        run: node npm/prepare.mjs --version 0.0.0 --dry-run
      - name: Build
        run: cargo build --locked
      # One debug binary stands in for all four release assets: this checks the
      # plumbing (layout, resolution, exec), not the cross-compiles.
      - name: Stage it as the release assets
        run: |
          mkdir -p dist
          for target in aarch64-apple-darwin x86_64-apple-darwin x86_64-unknown-linux-gnu; do
            cp target/debug/glslint "dist/glslint-$target"
          done
          cp target/debug/glslint dist/glslint-x86_64-pc-windows-msvc.exe
      - name: Lay out the packages
        run: node npm/prepare.mjs --version 0.0.0 --binaries dist
      # Resolve the linux-x64 package the way an install would, so the wrapper's
      # require.resolve finds it by walking up to the repo root's node_modules.
      - name: Link the platform package as an installed dependency
        run: |
          mkdir -p node_modules/@glslint
          ln -s ../../npm/@glslint/linux-x64 node_modules/@glslint/linux-x64
      - name: Run glslint through the npm shim
        run: |
          # Transparent passthrough: the shim must report exactly what the
          # binary does, and mirror its exit status (no args is usage, exit 2).
          test "$(node npm/glslint/bin/glslint.js --version)" = "$(target/debug/glslint --version)"
          node npm/glslint/bin/glslint.js && code=0 || code=$?
          test "$code" = 2
      - name: sccache stats
        if: ${{ always() }}
        run: sccache --show-stats

  deny:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
        with:
          command: check advisories bans licenses sources