Skip to content

feat: release v0.1.0 #94

feat: release v0.1.0

feat: release v0.1.0 #94

Workflow file for this run

name: CI
on:
push:
branches: [master, main]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
rust:
name: Rust tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- 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 }}-${{ runner.arch }}-${{ hashFiles('Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-${{ runner.arch }}-
- name: Build (release)
run: cargo build --release
- name: Test (release)
run: cargo test --release
- name: Test scalar-only (no AVX2/NEON 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
with:
submodules: recursive
- 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("qjson") 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'
- name: Validate LuaRocks package
run: |
rm -rf /tmp/lua-qjson-rock
ROCKSPEC="$(ls -1 rockspec/lua-qjson-*.rockspec | sort | tail -n1)"
luarocks make "$ROCKSPEC" --tree /tmp/lua-qjson-rock
eval "$(luarocks path --tree /tmp/lua-qjson-rock)"
unset LD_LIBRARY_PATH
luajit -e 'local qjson = require("qjson"); local doc = qjson.parse("{\"a\":42}"); assert(doc:get_i64("a") == 42)'
busted --lua=$(which luajit) tests/lua
package:
name: LuaRocks package (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: rust
strategy:
matrix:
os: [ubuntu-latest, macos-14]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust (stable)
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
- name: Install LuaJIT
uses: leafo/gh-actions-lua@v13
with:
luaVersion: "luajit-2.1.0-beta3"
- name: Install LuaRocks
uses: leafo/gh-actions-luarocks@v4
with:
luarocksVersion: "3.11.1"
- name: Validate LuaRocks package
run: |
rm -rf /tmp/lua-qjson-rock
ROCKSPEC="$(ls -1 rockspec/lua-qjson-*.rockspec | sort | tail -n1)"
luarocks make "$ROCKSPEC" --tree /tmp/lua-qjson-rock
eval "$(luarocks path --tree /tmp/lua-qjson-rock)"
unset LD_LIBRARY_PATH
unset DYLD_LIBRARY_PATH
luajit -e 'local qjson = require("qjson"); local doc = qjson.parse("{\"a\":42}"); assert(doc:get_i64("a") == 42)'