Place C bindings behind ffi
feature flag, add FFI CI
#510
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: cargo fmt --all -- --check | |
- run: cargo clippy --all | |
docs: | |
name: cargo doc | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo doc --workspace --no-deps --all-features | |
test: | |
name: test | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
ffi: | |
name: ffi | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install cbindgen | |
run: cargo install --force cbindgen | |
- name: Build (with feature falg) | |
run: cargo build --verbose --features="ffi" | |
- name: Generate C header file | |
run: cbindgen --config cbindgen.toml --crate rsdd --output rsdd.h | |
- name: Compile sample .c file | |
run: gcc scripts/main.c -o main -lrsdd -L./target/debug | |
- name: Run main file | |
run: ./main | |
wasm: | |
name: wasm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Build | |
run: wasm-pack build |