-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(capi): Move CAPI generation to its own crate (#234)
* refactor(capi): Move CAPI generation to its own crate * reduce Biscuit visibility * remove capi.rs * add `print_block_source` c binding * add test for `biscuit_print_block_source` + use `inttypes.h` macros for handling cross-platform `uint64_t` type * remove `block()` usage and C-API usage
- Loading branch information
1 parent
bf2f22a
commit 4e6b2c8
Showing
13 changed files
with
425 additions
and
357 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,69 +2,50 @@ name: Rust | |
|
||
on: | ||
push: | ||
branches: [ main ] | ||
branches: [main] | ||
pull_request: | ||
branches: [ main, v5 ] | ||
branches: [main, v5] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo | ||
target/ | ||
key: ${{ runner.os }}-${{ hashFiles('Cargo.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ hashFiles('Cargo.toml') }} | ||
${{ runner.os }}- | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --features="serde-error,bwk" --verbose | ||
- name: Check samples | ||
run: | | ||
cd biscuit-auth | ||
cargo run --release --example testcases --features serde-error -- ./samples --json > ./samples/samples.json | ||
git diff --exit-code | ||
- uses: actions/checkout@v2 | ||
- name: Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo | ||
target/ | ||
key: ${{ runner.os }}-${{ hashFiles('Cargo.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ hashFiles('Cargo.toml') }} | ||
${{ runner.os }}- | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --features="serde-error,bwk" --verbose | ||
- name: Check samples | ||
run: | | ||
cd biscuit-auth | ||
cargo run --release --example testcases --features serde-error -- ./samples --json > ./samples/samples.json | ||
git diff --exit-code | ||
capi: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
- name: Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo | ||
target/ | ||
key: ${{ runner.os }}-cargoc-${{ hashFiles('Cargo.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargoc-${{ hashFiles('Cargo.toml') }} | ||
${{ runner.os }}-cargoc- | ||
${{ runner.os }}-${{ hashFiles('Cargo.toml') }} | ||
${{ runner.os }}- | ||
- name: Install cargo-c | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: install | ||
args: cargo-c --version 0.9.14+cargo-0.66 | ||
- name: Run cargo-c tests | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: ctest | ||
args: --release | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
- name: Install cargo-c | ||
run: cargo install cargo-c --version 0.10.5+cargo-0.83.0 | ||
- name: Run cargo-c tests | ||
run: cargo ctest --features="capi" --release | ||
|
||
coverage: | ||
name: Coverage | ||
|
@@ -94,4 +75,4 @@ jobs: | |
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: biscuit-auth/biscuit-rust | ||
slug: biscuit-auth/biscuit-rust |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[workspace] | ||
members = ["biscuit-auth", "biscuit-quote", "biscuit-parser"] | ||
members = ["biscuit-auth", "biscuit-quote", "biscuit-parser", "biscuit-capi"] |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[package] | ||
name = "biscuit-capi" | ||
version = "5.0.0" # Should keep the same version as biscuit-auth | ||
description = "C API for Biscuit" | ||
authors = ["Geoffroy Couprie <[email protected]>"] | ||
edition = "2018" | ||
license = "Apache-2.0" | ||
documentation = "https://docs.rs/biscuit-auth" | ||
homepage = "https://github.com/biscuit-auth/biscuit" | ||
repository = "https://github.com/biscuit-auth/biscuit-rust" | ||
|
||
[dependencies] | ||
biscuit-auth = { version = "5.0.0", path = "../biscuit-auth", features = [ | ||
"datalog-macro", | ||
"serde-error", | ||
] } | ||
inline-c = { version = "0.1", optional = true } | ||
rand = "0.8" | ||
|
||
[features] | ||
default = [] | ||
capi = ["inline-c"] | ||
|
||
[package.metadata.capi.library] | ||
# Used as the library name and defaults to the crate name. This might get | ||
# prefixed with `lib` depending on the target platform. | ||
name = "biscuit_auth" | ||
|
||
[package.metadata.capi.header] | ||
name = "biscuit_auth" |
Oops, something went wrong.