mlua-extras 11.6.2

Extra helpers and functionality built on top of mlua for embedded lua development
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    # Run the tests in each of the feature combinations.
    # This is not an exhaustive test of all possible combinations,
    # just those that affect the code in the crate.
    name: test (${{ matrix.features }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        features:
          # No features at all
          - ""
          # lua54+vendored base, then all combinations of: send, async, macros
          - lua54,vendored
          - lua54,vendored,send
          - lua54,vendored,async
          - lua54,vendored,macros
          - lua54,vendored,macros,userdata-wrappers
          - lua54,vendored,send,async
          - lua54,vendored,send,macros
          - lua54,vendored,async,macros
          - lua54,vendored,send,async,macros
          # Full feature set including macros
          - lua54,vendored,send,async,macros
          # Luau feature combinations
          - luau,vendored
          - luau,vendored,macros,userdata-wrappers
          - luau,vendored,send,async,macros
    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable

      - name: Install luau-lsp
        if: contains(matrix.features, 'luau')
        run: |
          curl -fsSL -o luau-lsp.zip https://github.com/JohnnyMorganz/luau-lsp/releases/latest/download/luau-lsp-linux-x86_64.zip
          unzip luau-lsp.zip -d luau-lsp
          chmod +x luau-lsp/luau-lsp
          echo "$PWD/luau-lsp" >> "$GITHUB_PATH"

      - name: Install lua-language-server
        if: matrix.features != ''
        run: |
          VERSION=$(curl -sI https://github.com/LuaLS/lua-language-server/releases/latest \
            | grep -i location | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
          mkdir /tmp/lua-ls
          curl -fsSL "https://github.com/LuaLS/lua-language-server/releases/download/${VERSION}/lua-language-server-${VERSION}-linux-x64.tar.gz" \
            | tar -xz -C /tmp/lua-ls
          echo "/tmp/lua-ls/bin" >> "$GITHUB_PATH"

      - name: Check
        run: cargo check ${{ matrix.features && format('--features {0}', matrix.features) }}

      - name: Test
        # Note: we're not doing a full `cargo test` here because some doc comments
        # implicitly rely on feature flags that may not be present in a given invocation
        run: cargo test --lib --tests ${{ matrix.features && format('--features {0}', matrix.features) }}

  docs:
    # Test building the docs, and the doc comment code samples
    name: docs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable

      # Grab the features from the manifest so that we're not duplicating
      # them here in this workflow.  This enables running the docs the
      # same way that docs.rs will run them.
      - name: Extract docs.rs features
        id: docsrs
        run: |
          features=$(cargo metadata --format-version 1 --no-deps \
            | jq -r '.packages[]
                      | select(.name == "mlua-extras")
                      | .metadata.docs.rs.features
                      | join(",")')
          echo "features=$features" >> "$GITHUB_OUTPUT"

      # Now build the docs with that set of features
      - name: Build docs
        env:
          RUSTDOCFLAGS: -D warnings
        run: cargo doc --no-deps --features "${{ steps.docsrs.outputs.features }}"

      # And the doc comment inline code samples
      - name: Doc tests
        run: cargo test --doc --features "${{ steps.docsrs.outputs.features }}"