Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial yarp-sys (Rust bindings) #1093

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/rust-bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
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:
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
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
${{ runner.os }}-cargo
- name: rake compile
run: bundle exec rake compile
- name: cargo test
turboladen marked this conversation as resolved.
Show resolved Hide resolved
working-directory: rust/yarp-sys
run: cargo test

cargo-clippy:
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
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
${{ runner.os }}-cargo
- name: rake compile
run: bundle exec rake compile
- name: cargo clippy
working-directory: rust/yarp-sys
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]
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/yarp-sys
run: cargo test -Zbuild-std --verbose --target=x86_64-unknown-linux-gnu
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The repository contains the infrastructure for both a shared library (librubypar
│   ├── yarp Ruby library files
│   └── yarp.rb main entrypoint for the Ruby library
├── rakelib various Rake tasks for the project
├── rust
│   └── yarp-sys FFI binding for Rust
├── src
│   ├── enc various encoding files
│   ├── util various utility files
Expand All @@ -45,7 +47,7 @@ The repository contains the infrastructure for both a shared library (librubypar
To compile the shared library, you will need:

* A C99 compiler
* autotools (autoconf, automake, libtool)
* autotools autoconf, automake, libtool)
* make
* Ruby 3.3.0-preview1 or later

Expand Down Expand Up @@ -84,3 +86,4 @@ See the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information. We additio
* [Ripper](docs/ripper.md)
* [Serialization](docs/serialization.md)
* [Testing](docs/testing.md)

1 change: 1 addition & 0 deletions rakelib/check_manifest.rake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ task :check_manifest => [:templates] do
java
pkg
rakelib
rust
templates
test
tmp
Expand Down
1 change: 1 addition & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
9 changes: 9 additions & 0 deletions rust/yarp-sys/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# will have compiled files and executables
debug/
target/

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
Loading
Loading