Skip to content

build: add lua-cjson submodule and fix make bench for macOS (#16) #32

build: add lua-cjson submodule and fix make bench for macOS (#16)

build: add lua-cjson submodule and fix make bench for macOS (#16) #32

Workflow file for this run

name: CI
on:
push:
branches: [master, main]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
rust:
name: Rust tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable)
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
- name: Cache cargo registry & target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Build (release)
run: cargo build --release
- name: Test (release)
run: cargo test --release
- name: Test scalar-only (no AVX2 feature)
run: cargo test --release --no-default-features
- name: Test with test-panic feature
run: cargo test --features test-panic --release
lua:
name: Lua integration tests
runs-on: ubuntu-latest
needs: rust
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable)
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
- name: Cache cargo registry & target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Build cdylib
run: cargo build --release
- name: Install LuaJIT, LuaRocks and dependencies
run: |
sudo apt-get update
sudo apt-get install -y luajit lua5.1 liblua5.1-0-dev luarocks
# luarocks on Ubuntu targets lua5.1 by default; LuaJIT is ABI-compatible
# with 5.1 so rocks built for 5.1 load fine under luajit.
sudo luarocks install busted
sudo luarocks install lua-cjson
- name: Run busted tests (under LuaJIT)
run: |
# ffi.load("quickdecode") uses dlopen which respects LD_LIBRARY_PATH,
# not LuaJIT's package.cpath. Point dlopen at the release build dir.
LD_LIBRARY_PATH="$PWD/target/release" \
busted --lua=$(which luajit) tests/lua \
--lpath='./lua/?.lua'