WIP
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
This commit is contained in:
parent
94c3f12c57
commit
6d07bcde93
|
|
@ -53,36 +53,20 @@ jobs:
|
||||||
|
|
||||||
# If glibc, compile and test all
|
# If glibc, compile and test all
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
name: "Build"
|
name: "Build glibc"
|
||||||
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
||||||
with:
|
with:
|
||||||
command: build
|
command: build
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
args: --target ${{ matrix.target }} --all-features
|
args: --target ${{ matrix.target }} --all-features
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
name: "Test"
|
name: "Test glibc"
|
||||||
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
args: --target ${{ matrix.target }} --all-features
|
args: --target ${{ matrix.target }} --all-features
|
||||||
|
|
||||||
# If glibc, compile and test only the core module with no_std
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
name: "Build"
|
|
||||||
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
|
||||||
with:
|
|
||||||
command: build
|
|
||||||
toolchain: ${{ matrix.toolchain }}
|
|
||||||
args: --target ${{ matrix.target }} --package cloudevents-sdk --workspace --no-default-features
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
name: "Test"
|
|
||||||
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
|
||||||
with:
|
|
||||||
command: test
|
|
||||||
toolchain: ${{ matrix.toolchain }}
|
|
||||||
args: --target ${{ matrix.target }} --package cloudevents-sdk --workspace --no-default-features
|
|
||||||
|
|
||||||
# If musl, compile and test all
|
# If musl, compile and test all
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
name: "Build"
|
name: "Build"
|
||||||
|
|
@ -145,3 +129,31 @@ jobs:
|
||||||
command: build
|
command: build
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
args: --target ${{ matrix.target }} --manifest-path ./example-projects/warp-example/Cargo.toml
|
args: --target ${{ matrix.target }} --manifest-path ./example-projects/warp-example/Cargo.toml
|
||||||
|
|
||||||
|
check_no_std:
|
||||||
|
name: Check no_std
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
# Caching stuff
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
key: ${{ runner.os }}-cargo-no-std-deps-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
target/
|
||||||
|
key: ${{ runner.os }}-cargo-no-std-build-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
- name: Download cargo-nono
|
||||||
|
run: curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git hobofan/cargo-nono
|
||||||
|
- name: Run check
|
||||||
|
run: ./cargo-nono check
|
||||||
|
|
|
||||||
13
Cargo.toml
13
Cargo.toml
|
|
@ -17,6 +17,11 @@ categories = ["web-programming", "encoding", "data-structures", "no_std"]
|
||||||
name = "cloudevents"
|
name = "cloudevents"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
# Without default features, the package acts as no_std
|
||||||
|
default = ["std"]
|
||||||
|
|
||||||
|
std = ["snafu/std", "url"]
|
||||||
|
|
||||||
actix = ["actix-web", "async-trait", "lazy_static", "bytes", "futures"]
|
actix = ["actix-web", "async-trait", "lazy_static", "bytes", "futures"]
|
||||||
reqwest = ["reqwest-lib", "async-trait", "lazy_static", "bytes"]
|
reqwest = ["reqwest-lib", "async-trait", "lazy_static", "bytes"]
|
||||||
rdkafka = ["rdkafka-lib", "lazy_static", "bytes", "futures"]
|
rdkafka = ["rdkafka-lib", "lazy_static", "bytes", "futures"]
|
||||||
|
|
@ -28,16 +33,10 @@ serde_json = "^1.0"
|
||||||
chrono = { version = "^0.4", features = ["serde"] }
|
chrono = { version = "^0.4", features = ["serde"] }
|
||||||
delegate-attr = "^0.2"
|
delegate-attr = "^0.2"
|
||||||
base64 = "^0.12"
|
base64 = "^0.12"
|
||||||
snafu = { version = "^0.6", default-features = false}
|
snafu = { version = "^0.6", default-features = false }
|
||||||
bitflags = "^1.2"
|
bitflags = "^1.2"
|
||||||
url = { version = "^2.1", features = ["serde"], optional = true }
|
url = { version = "^2.1", features = ["serde"], optional = true }
|
||||||
|
|
||||||
[features]
|
|
||||||
# Without default features, the package acts as no_std
|
|
||||||
default = ["std"]
|
|
||||||
|
|
||||||
std = ["snafu/std", "url"]
|
|
||||||
|
|
||||||
# runtime optional deps
|
# runtime optional deps
|
||||||
actix-web = { version = "^3", default-features = false, optional = true }
|
actix-web = { version = "^3", default-features = false, optional = true }
|
||||||
reqwest-lib = { version = "^0.11", default-features = false, features = ["rustls-tls"], optional = true, package = "reqwest" }
|
reqwest-lib = { version = "^0.11", default-features = false, features = ["rustls-tls"], optional = true, package = "reqwest" }
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
[package]
|
||||||
|
name = "no-std-example"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
cloudevents-sdk = { path = "../..", default-features = false }
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
panic = "abort"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
panic = "abort"
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
|
use cloudevents;
|
||||||
|
use cloudevents::EventBuilder;
|
||||||
|
|
||||||
|
#[panic_handler]
|
||||||
|
fn panic(_info: &PanicInfo) -> ! {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn _start() -> ! {
|
||||||
|
loop {
|
||||||
|
#[allow(dead_code)]
|
||||||
|
let event = cloudevents::EventBuilderV10::new()
|
||||||
|
.id("my_id")
|
||||||
|
.source("my_source")
|
||||||
|
.subject("some_subject")
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
//! [Responders]: https://actix.rs/docs/handlers/
|
//! [Responders]: https://actix.rs/docs/handlers/
|
||||||
|
|
||||||
#![deny(broken_intra_doc_links)]
|
#![deny(broken_intra_doc_links)]
|
||||||
|
|
||||||
#![cfg_attr(not(any(feature = "std", test)), no_std)]
|
#![cfg_attr(not(any(feature = "std", test)), no_std)]
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
|
|
@ -62,7 +63,9 @@ extern crate std as alloc;
|
||||||
#[cfg(any(feature = "std", test))]
|
#[cfg(any(feature = "std", test))]
|
||||||
extern crate std as core;
|
extern crate std as core;
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
pub mod binding;
|
pub mod binding;
|
||||||
|
|
||||||
pub mod event;
|
pub mod event;
|
||||||
pub mod message;
|
pub mod message;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue