Skip to content

JavaScript bindings #714

JavaScript bindings

JavaScript bindings #714

Workflow file for this run

---
name: Rust Bindings
on:
push:
paths:
- ".github/workflows/rust-bindings.yml"
- "include/"
- "src/"
- "rust/"
- "*akefile*"
branches:
- main
pull_request:
env:
RUSTFLAGS: "-D warnings"
jobs:
cargo-test:
strategy:
fail-fast: false
matrix:
crate: [prism-sys, prism]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: head
bundler-cache: true
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.71.1"
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.crate }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.crate }}-${{ hashFiles('Cargo.toml') }}
${{ runner.os }}-cargo-${{ matrix.crate }}
- name: rake compile
run: bundle exec rake compile
- name: cargo test
working-directory: rust/${{ matrix.crate }}
run: cargo test
cargo-clippy:
strategy:
fail-fast: false
matrix:
crate: [prism-sys, prism]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: head
bundler-cache: true
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.71.1"
components: clippy
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.crate }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.crate }}-${{ hashFiles('Cargo.toml') }}
${{ runner.os }}-cargo-${{ matrix.crate }}
- name: rake compile
run: bundle exec rake compile
- name: cargo clippy
working-directory: rust/${{ matrix.crate }}
run: cargo clippy --tests -- -W "clippy::pedantic"
sanitizer-test:
name: Test with -Zsanitizer=${{ matrix.sanitizer }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer: [address, leak]
crate: [prism-sys, prism]
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: head
bundler-cache: true
- name: rake compile
run: bundle exec rake compile
- uses: dtolnay/rust-toolchain@nightly
with:
target: "x86_64-unknown-linux-gnu"
components: "rust-src"
- name: Test with sanitizer
env:
RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }}
RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }}
# only needed by asan
ASAN_OPTIONS: detect_stack_use_after_return=1
# Asan's leak detection occasionally complains
# about some small leaks if backtraces are captured,
# so ensure they're not
RUST_BACKTRACE: 0
working-directory: rust/${{ matrix.crate }}
run: cargo test -Zbuild-std --verbose --target=x86_64-unknown-linux-gnu