mlua 0.5.3

High level bindings to Lua 5.4/5.3/5.2/5.1 (including LuaJIT) with async/await features and support of writing native lua modules in Rust.
Documentation
name: CI
on: [push, pull_request]

jobs:
  build:
    name: Build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-18.04, macos-latest, windows-latest]
        rust: [stable]
        lua: [lua54, lua53, lua52, lua51, luajit]
        include:
        - os: ubuntu-18.04
          target: x86_64-unknown-linux-gnu
        - os: macos-latest
          target: x86_64-apple-darwin
        - os: windows-latest
          target: x86_64-pc-windows-msvc
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust }}
        target: ${{ matrix.target }}
        override: true
    - name: Build ${{ matrix.lua }} vendored
      run: |
        cargo build --release --features "${{ matrix.lua }} vendored"
        cargo build --release --features "${{ matrix.lua }} vendored async send serialize"
      shell: bash
    - name: Build ${{ matrix.lua }} pkg-config
      if: ${{ matrix.os == 'ubuntu-18.04' && matrix.lua != 'lua54' }}
      run: |
        sudo apt-get update
        sudo apt-get install -y --no-install-recommends liblua5.3-dev liblua5.2-dev liblua5.1-0-dev libluajit-5.1-dev
        cargo build --release --features "${{ matrix.lua }}"

  build_aarch64_cross_macos:
    name: Cross-compile to aarch64-apple-darwin
    runs-on: macos-11.0
    needs: build
    strategy:
      matrix:
        lua: [lua54, lua53, lua52, lua51, luajit]
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: nightly
        target: aarch64-apple-darwin
        override: true
    - name: Cross-compile
      run: cargo build --target aarch64-apple-darwin --features "${{ matrix.lua }} async send serialize vendored"

  build_aarch64_cross_ubuntu:
    name: Cross-compile to aarch64-unknown-linux-gnu
    runs-on: ubuntu-18.04
    needs: build
    strategy:
      matrix:
        lua: [lua54, lua53, lua52, lua51, luajit]
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: nightly
        target: aarch64-unknown-linux-gnu
        override: true
    - name: Install ARM compiler toolchain
      run: |
        sudo apt-get update
        sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross
      shell: bash
    - name: Cross-compile
      run: cargo build --target aarch64-unknown-linux-gnu --features "${{ matrix.lua }} async send serialize vendored"
      shell: bash

  build_armv7_cross_ubuntu:
    name: Cross-compile to armv7-unknown-linux-gnueabihf
    runs-on: ubuntu-18.04
    needs: build
    strategy:
      matrix:
        lua: [lua54, lua53, lua52, lua51]
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: nightly
        target: armv7-unknown-linux-gnueabihf
        override: true
    - name: Install ARM compiler toolchain
      run: |
        sudo apt-get update
        sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross
      shell: bash
    - name: Cross-compile
      run: cargo build --target armv7-unknown-linux-gnueabihf --features "${{ matrix.lua }} async send serialize vendored"
      shell: bash

  test:
    name: Test
    runs-on: ${{ matrix.os }}
    needs: build
    strategy:
      matrix:
        os: [ubuntu-18.04, macos-latest, windows-latest]
        rust: [stable]
        lua: [lua54, lua53, lua52, lua51, luajit]
        include:
        - os: ubuntu-18.04
          target: x86_64-unknown-linux-gnu
        - os: macos-latest
          target: x86_64-apple-darwin
        - os: windows-latest
          target: x86_64-pc-windows-msvc
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust }}
        target: ${{ matrix.target }}
        override: true
    - name: Run ${{ matrix.lua }} tests
      if: ${{ matrix.os != 'macos-latest' || matrix.lua != 'luajit' }}
      run: |
        cargo test --release --features "${{ matrix.lua }} vendored"
        cargo test --release --features "${{ matrix.lua }} vendored async send serialize"
      shell: bash
    - name: Run compile tests (macos lua53)
      if: ${{ matrix.os == 'macos-latest' && matrix.lua == 'lua53' }}
      run: |
        TRYBUILD=overwrite cargo test --release --features "${{ matrix.lua }} vendored" -- --ignored
        TRYBUILD=overwrite cargo test --release --features "${{ matrix.lua }} vendored async send serialize" -- --ignored
      shell: bash

  test_luajit_macos:
    name: Test LuaJIT on macOS
    runs-on: macos-latest
    needs: build
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: nightly
        target: x86_64-apple-darwin
        override: true
    - name: Run LuaJIT 2.0.5 tests
      run: |
        brew install luajit
        cargo test --tests --release --features "luajit async send serialize" -- --test-threads=1
      shell: bash
    - name: Run LuaJIT vendored tests
      run: |
        cargo test --release --features "luajit vendored async send serialize"
      shell: bash

  test_modules:
    name: Test modules
    runs-on: ${{ matrix.os }}
    needs: build
    strategy:
      matrix:
        os: [ubuntu-18.04, macos-latest]
        rust: [stable]
        lua: [lua54, lua53, lua52, lua51, luajit]
        include:
        - os: ubuntu-18.04
          target: x86_64-unknown-linux-gnu
        - os: macos-latest
          target: x86_64-apple-darwin
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust }}
        target: ${{ matrix.target }}
        override: true
    - name: Run ${{ matrix.lua }} module tests
      run: |
        (cd examples/module && cargo build --release --features "${{ matrix.lua }} vendored")
        (cd tests/module && cargo test --release --features "${{ matrix.lua }} vendored")
      shell: bash

  test_modules_windows:
    name: Test modules on Windows
    runs-on: windows-latest
    needs: build
    strategy:
      matrix:
        lua: [lua53, luajit]
    defaults:
      run:
        shell: msys2 {0}
    steps:
    - uses: msys2/setup-msys2@v2
    - uses: actions/checkout@v2
    - name: Install Rust & Lua
      run: |
        pacman -S --noconfirm mingw-w64-x86_64-rust mingw-w64-x86_64-lua mingw-w64-x86_64-luajit mingw-w64-x86_64-pkg-config
    - name: Run ${{ matrix.lua }} module tests
      run: |
        (cd examples/module && cargo build --release --features "${{ matrix.lua }}")
        (cd tests/module && cargo test --release --features "${{ matrix.lua }}")

  rustfmt:
    name: Rustfmt
    runs-on: ubuntu-18.04
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        components: rustfmt
        override: true
    - run: cargo fmt -- --check

  clippy:
    name: Clippy check
    runs-on: ubuntu-18.04
    strategy:
      matrix:
        lua: [lua54, lua53, lua52, lua51, luajit]
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
            toolchain: nightly
            components: clippy
            override: true
      - uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --features "${{ matrix.lua }},vendored,async,send,serialize